In other words the button is tied up with the “ShowAlert” action. It would be great if we could decouple the behavior from the button so that any other behavior can be attached with the button.
<input type=”button” value=”ddd” onclick=”ShowAlert()” id=”btn” />
Look at this button code you can see no action is attached with the below button element.
<input type=”button” value=”ddd” id=”btn” />
var el = document.getElementById(“btn”);
el.onclick = ShowAlert;