Skip to content

Initial Completion#222

Open
JoeCarnahan42 wants to merge 10 commits intoprojectshft:masterfrom
JoeCarnahan42:master
Open

Initial Completion#222
JoeCarnahan42 wants to merge 10 commits intoprojectshft:masterfrom
JoeCarnahan42:master

Conversation

@JoeCarnahan42
Copy link

No description provided.

const postBtn = document.getElementById('post-btn');
const lineBreak = document.createElement('br');

function makePost() {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not es6 functions?

const postInput = document.getElementById('post-input');
const posterName = document.getElementById('name-input');
const postId = Math.random().toString(36).substr(2, 9);
if (postInput.value === "" || posterName.value === '') {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you are not trimming the input, this allows to make a post with empty spaces on any input.

makePost();
});

postList.addEventListener('click', function(e) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great

<h6><button type='button' class='btn btn-info btn-sm remove-comm' id='${commId}'>Remove</button>
${commTextInput.value} - Posted By: ${commNameInput.value}</h6>`;
commentSection.innerHTML = ''
commentSection.appendChild(commDiv);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

on each comment you are recreating the whole comments div.
Better to append just the comment itself.

const newComment = document.createElement('h6');
newComment.innerHTML = commData;
commentSection.appendChild(newComment);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments