I am attempting to get two functions to trigger with one button. Could someone help me what I did wrong?
I know that I can just add the text from function one from function two, but my goal was to complete two functions under one button.
<p id="demo" style="display:none">JavaScript can show hidden HTML elements.</p>
<p id="demoTwo" style="display:none">Hello JavaScript!</p>
<button type="button" onclick="document.getElementById('demo').style.display='block'" onclick="document.getElementById('demoTwo').style.display='block'">Click Me!</button>
I was wanting both function’s text to appear at the button click. However, only the first function completed.
onclickhandlers. You can do this in oneonclickhandleronclick="document.getElementById('demo').style.display='block';document.getElementById('demoTwo').style.display='block'".