Cheap VPS & Xen Server

Residential Proxy Network - Hourly & Monthly Packages

HTML Input Tag


The HTML <input> tag is used to represent a form input control in HTML document. This form input control facilitate user to input data and communicate with a website or application. Let’s take an example of an HTML form with three input fields, two text fields and one button for submission.


HTML Input Tag Example

Let’s see the example of HTML input tag.

  1. <form action=“#”>
  2. First name: <input type=“text” name=“FirstName”  placeholder=“enter firstname…”><br>
  3. Last name: <input type=“text” name=“LastName” placeholder=“enter lastname…”><br>
  4. <input type=“submit” value=“Submit”>
  5. </form>

Test it Now

Output:

First name:
Last name:

Click the “Submit” button for sending the form-data to a page on the server.


Points to remember

1) Use the input element within the form element to declare input control that allow user to enter data.

2) The input element is empty. It contains attributes only. There is no need of an end tag in HTML.

3) If you want to define labels for input element, use the label element with each input tag.


Difference between HTML4.01 and HTML5

HTML5 does not support “align” attribute. There are several new attributes for <input> tag in HTML5, and the type attribute has several new values.


Difference between HTML and XHTML

In HTML, <input> tag is used without an end tag. In XHTML, the <input> tag must be properly closed.


Supporting Browsers

Element chrome_browser Chrome ie_browser IE firefox_browser Firefox opera_browser Opera safari_browser Safari
<input> Yes Yes Yes Yes Yes

Comments

comments