js body.onclick or html.onclick code example
Example: html js button onclick
// In HTML:
// <button id="buttonID" onclick="yourJSFunction()">Text</button>
// In JavaScript:
function yourJSFunction() {
// Do stuff
}
// In HTML:
// <button id="buttonID" onclick="yourJSFunction()">Text</button>
// In JavaScript:
function yourJSFunction() {
// Do stuff
}