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
How to change text color on click using JavaScript?
How to declare multiple variables in one statement in Javascript?
jQuery show input text inside div after on click event
How to show hide option list items using jQuery?
JavaScript check if first string contains all characters of second string
JavaScript sort multi dimensional array on specific columns