HTML form contains HTML form elements. HTML form elements are different types of input elements like checkboxes, text fields, submit buttons, radio buttons, etc.
The <input> Element:
The input element is used to create form fields, to take input from the user. We can use different input fields to collect information from the users.
The input element can be displayed in different ways, depending on the type attribute.
Note: You will learn more about input types later in this tutorial.
The <select> Element:
HTML <select> element is used to create a drop-down list of option.
The drop-down list will appear when we click on the form element and allows the user to choose one of the options.
The <option> element is used to define the possible options to select from.
The <option> tag is put inside the <select> tag.
The first item in the drop-down list is selected by default, to define the pre-selected option you can add the selected attribute to the option.
The <datalist> element specifies a set of pre-defined options for an <input> element, which can be used to provide the quick choices for an input field. To bind the<datalist> element together the list attribute of the input element is used.
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.Ok