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
Check if a string ends with the given target string
How can I redirect the user from one page to another using jQuery or pure JavaScript?
How to change the height of Textarea on click?
ES6 method of declaration multiple variables in one line
How to change text color on click using JavaScript?
How to join string with number in JavaScript?
JavaScript HTML5 Validation for name and email field
jQuery simple form with name and email validations
Image Rollover Using onMouseOver and onMouseOut
How to set checkbox and radio option checked on load with jQuery?