The HTML <input type="button"> element is used to create a clickable button in a webpage. It performs custom actions using JavaScript when clicked.
- Used to create a clickable button for custom actions.
- Created using <input type="button"> and commonly used with JavaScript.
- Supports attributes like value, onclick, disabled, and name.
Syntax:
<input type="button"> Example: Demonstrate the use of the HTML <input type="button"> element.
<!--Driver Code Starts-->
<html>
<head>
<title>
HTML Input Type Button
</title>
</head>
<!--Driver Code Ends-->
<body style="text-align:center;">
<h2>HTML <input type = "button"></h2>
<form action="#">
<label for="button">Click this Button</label>
<input type="button" id="button"
onclick="send()" value="Click Here!">
</form>
<script>
function send() {
alert("Welcome to GeeksforGeeks");
}
</script>
</body>
<!--Driver Code Starts-->
</html>
<!--Driver Code Ends-->