Question: Write JAVASCRIPT for toggleCommentButton a. Receives a postId as the parameter b. Selects the button with the data-post-id attribute equal to the postId received as

Write JAVASCRIPT for

toggleCommentButton

a. Receives a postId as the parameter

b. Selects the button with the data-post-id attribute equal to the postId received as a

parameter

c. If the button textContent is 'Show Comments' switch textContent to 'Hide

Comments'

d. If the button textContent is 'Hide Comments' switch textContent to 'Show

Comments'

e. Suggestion (not required) for above: try a ternary statement

f. Return the button element*/


 

function toggleCommentButton(PostId) {

}


Step by Step Solution

3.43 Rating (156 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

The JavaScript code for the toogleCommentButton function based on your r... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!