Conversation
| <ul class="nav nav-pills"> | ||
| <li role="presentation" class="active"><a href="#">Submit</a></li> |
There was a problem hiding this comment.
never use ul or lists for buttons, use the button tag and you have 'btn btn-primary' bootstrap classes
| <span class="rm-comments-btn">remove</span> | ||
| <span class="show-comments-btn">comments:</span> |
There was a problem hiding this comment.
same, could have been buttons
<button class="btn btn-danger btn-sm">Remove</button>
<button class="btn btn-info btn-sm">Show Comments</button>
| const inputName = document.getElementsByClassName('name')[0].value; | ||
|
|
||
| const newSpan = document.createElement('span'); | ||
| newSpan.innerHTML = `${inputPost}, posted by ${inputName}`; |
There was a problem hiding this comment.
this is less recommented, use textContent or appendChild as they are safer and more performant.
|
|
||
| const inputPost = document.getElementsByClassName('post')[0].value; | ||
| const inputName = document.getElementsByClassName('name')[0].value; | ||
|
|
||
| const newSpan = document.createElement('span'); | ||
| newSpan.innerHTML = `${inputPost}, posted by ${inputName}`; |
There was a problem hiding this comment.
your code alignment is off, check your lint settings. This affects readability.
|
|
||
| toggleButtons.forEach(button => { | ||
| button.addEventListener('click', function () { | ||
|
|
| }) | ||
|
|
||
| const toggleButtons = document.querySelectorAll('.show-comments-btn'); | ||
|
|
|
|
||
|
|
| margin-left: 4px; | ||
| } | ||
|
|
||
| /* button { |
| @@ -0,0 +1,39 @@ | |||
| const submitButton = document.getElementsByClassName('active')[0]; | |||
There was a problem hiding this comment.
better to have consistency, either use getElementsByClassName or querySelector
| const toggleButtons = document.querySelectorAll('.show-comments-btn'); | ||
|
|
||
|
|
||
| toggleButtons.forEach(button => { |
There was a problem hiding this comment.
this should have been a separate function with ternary operation https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Conditional_operator
function toggleVisibility(element) {
element.style.display = element.style.display === 'none' ? 'block' : 'none';
}
No description provided.