How to Create a Button in Web –in HTML

Share and Enjoy !

Button is an important aspect of website.Rather in client side button is the heart of webpage. Basically it triggers any action. it is very important to learn the functionality of button.So a button is a graphical representation of trigger point of an HTML page.

This article is mainly for automation test engineers who work on button object.

Let us understand how the developers create a button.

<input type=”button”/>

Well this is enough to create a button. This is how the button will look like.

let us do little more.. let us give it a name..I am creating a button with a name “button1” and display for user will be Click me.

 <title> Testing button </title>
 <form name=”form1″>
 <input type=”button” name=”button1″ value=”Click me”/>

The output will be..

Let us understand the argument and properties of a button

ArgumentsStringWhat shall appear on top of the button
numThis is bit interesting.When there are multiple button with same name then this number becomes handy.Remember descriptive programming , we use index a property to uniquely identify an element.  
PropertiesformThis property is required when form object of the button needs to be passed
namemandate property to uniquely identify a specifies the name attribute
typeThis is required to create a button and specific input to <input> tag. This is always button for button class
valueThis is the string which is seen when a webpage runs
idThis is to set an id for a specific object for a web. We mainly use this feature when we filter a webpage by using getElementbyID

image credit:

See also  Best Tip to Use 4 Methods in Button in JavaScript

Share and Enjoy !

Leave a Reply

Your email address will not be published. Required fields are marked *