Javascript examples for DOM Event:onclick
Inside onClick to get reference to function and hardcoded parameters
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> </head> <body> <button id="my-button" onclick="test('hello world')"> TEST </button> <button onclick="triggerTest()"> TRIGGER TEST </button> <script type="text/javascript"> function test(word) {// w w w . j a v a2 s . co m console.log(word); } function triggerTest() { var tempClick = document.querySelector('#my-button').onclick; tempClick.call(tempClick); } </script> </body> </html>