use of onclick in javascript code example
Example 1: javascript button
<button onclick="Function()">Text</button>
Example 2: javascript onclick button
var button = document.querySelector('button');
button.onclick = function() {
//do stuff
}
<button onclick="Function()">Text</button>
var button = document.querySelector('button');
button.onclick = function() {
//do stuff
}