Header Ads

how to use the html button tag with Example

 how to use the  html button tag with Example

html button tag


html button tag 

✷ The <input> tag is used, and its type property is set to button along with a value attribute that specifies the text that appears on the button. <input type="button" value="Click Me"> generates a button with the label "Click Me.

✷ Flexibility is a key distinction between the <button> element and <input type="button">. While <input type="button"> only shows plain text, the <button> tag can include HTML elements like graphics or text formatting.

 HTML clickable button that initiates a certain action when the user clicks on it can be created using the <input type="button">. This kind of button does not automatically transmit form data to the server, in contrast to the submit button. 

Syntax 

<input type="button">

Button Tag Example:-

<!DOCTYPE html>

<html>

<body>

<h2>Input Button</h2>

<input type="button"
onclick="alert('Hello World!')"value="Click Me!">

 </body>

</html>

how to use the  html button tag with Example

Explain 

Step 1 ]

<!Doctype html>

  • <!doctype html>  always be the first line of any HTML document.

Step 2 ]

   <html> and </html>
   html  is the root element.

Step 3 ]

<body> and </body>

body  is  main content area.

All visible content inside to  the <body> tag

Step 4]


<h2>Input Button</h2>

Displays heading titled on your page

Step 5]

<input type="button"
onclick="alert('Hello World!')"value="Click Me!">

type="button" :- specifies input button.

onclick ="alert('Hello World!')" :- JavaScript runs the button is clicked.

value="Click Me!"> :- label shows on the button

how to use the html button tag with Example

Button Tag output 

Button Tag output

Related Post :-

No comments

Powered by Blogger.