9951 explained code solutions for 126 technologies


htmlUsing onclick attribute in HTML


<button onclick="console.log('ok');"></button>ctrl + c
button

sample button to handle click for

onclick

defines javascript handler for this element

console.log('ok');

sample JS code to log ok to console (change to any code)