Horje

How to add HTML <input> type button Attribute

A push button that activates a JavaScript when it is clicked.

index.html
Example: HTML
<!DOCTYPE html>
<html>
<body>

<h1>Show a Push Button</h1>

<p>The button below activates a JavaScript function when it is clicked.</p>
<form>
  <input type="button" value="Click me" onclick="msg()">
</form>

<script>
function msg() {
  alert("Hello world!");
}
</script>

</body>
</html>

Output should be:

How to add HTML <input> type button Attribute




Type:
html
Category:
Web Tutorial
Sub Category:
HTML Tag
Uploaded by:
Admin