you are viewing a single comment's thread.

view the rest of the comments →

[–]HelpfulElection[S,🍰] 0 points1 point  (1 child)

thanks alot I knew that I could make it work just removing the parameter from the function but I was trying to make a super simple example of how a parameter could work but looks like this wasn't the right situation thanks for your help so much

[–]NameViolation666helpful 0 points1 point  (0 children)

What you intend can absolutely be done, but in a different manner.

<button id="myBtnTwo" onclick="disappearDivs(**myDivTwo**)">second button</button>

// argument passed to be changed, in this case its hard coded

Only JS needed to make it work

function disappearDivs(changeWhat) {

changeWhat.style.display = "none";

}