Cover Image for HTML Form Input
198 views

HTML Form Input

HTML Form Input is an HTML element that allows users to enter data into a web form. The input element can be used to create various types of form controls such as text inputs, checkboxes, radio buttons, and submit buttons.

The syntax for creating an input element is as follows:

<input type="text" name="input_name" value="initial_value">

The type attribute specifies the type of input control to create. For example, type="text" creates a text input, type="checkbox" creates a checkbox, and type="submit" creates a submit button. The name attribute specifies the name of the input, which is used to identify the input on the server-side when the form is submitted. The value attribute specifies the initial value of the input.

Here are some examples of different input types:


1. Text Input:

<input type="text" id="name" name="name">


2. Checkbox:

<input type="checkbox" id="agree" name="agree" value="yes">


3. Radio Buttons:

<label for="gender">Gender:</label>

<input type="radio" id="male" name="gender" value="male">
<label for="male">Male</label>

<input type="radio" id="female" name="gender" value="female">
<label for="female">Female</label>


4. Select List:

<select id="color" name="color">
  <option value="red">Red</option>
  <option value="green">Green</option>
  <option value="blue">Blue</option>
</select>


5. Submit Button:

<input type="submit" value="Submit">


These are just a few examples of the many types of form input elements available in HTML.

YOU MAY ALSO LIKE...

The Tech Thunder

The Tech Thunder

The Tech Thunder


COMMENTS