How to use an HTML button to call a JavaScript function?

JavascriptWeb DevelopmentFront End Technology

The simplest way to use an HTML button to call a JavaScript function is shown below −

<input id = "Double Click here" type = "button" value = "clickme" ondblclick = "myFunction();" />

You can also use the following by adding to the DOM property −

document.getElementById("Double Click here ").ondblclick = myFunction;
raja
Published on 23-Feb-2018 14:47:30
Advertisements