When the user clicks on the button, the onclick event has been fired and the JavaScript message listed in the value of the attribute are executed.
Example
<!DOCTYPE html>
<html>
<head>
<title>onClick Demo</title>
</head>
<body>
<input type="button" onclick="alert('You clicked the button!')" value="Click Me" />
</body>
</html>
Most Helpful This Week
What's the difference between let and var?
jQuery check if an element is visible or hidden
jQuery simple form validations between start date and end date
jQuery simple form with name and email validations
How to change text after click event using JavaScript?
Generate random password for form field on click using JavaScript