HTML <input type = “button”>

The HTML <input type=”button”> element creates a clickable button that can be customized with text or an image. It does not have any default behavior but can be used to perform actions using JavaScript. It makes versatile for various interactive purposes in web forms and applications.

Syntax

<input type="button"> 

Example: In this example, we will demonstrate the use of the HTML <input type=”button”> element.

html
<html>

<head>
    <title>
        HTML Input Type Button
    </title>
</head>

<body style="text-align:center;">
    <h2>HTML &lt;input type = "button"&gt;</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 w3wiki");
        }
    </script>
</body>

</html>

Output

Supported Browsers

  • Chrome 1
  • Edge 12
  • Firefox 1
  • Opera 15
  • Safari 1

Contact Us