Page 143 - TP_iPlus_V2.1_Class7
P. 143
Let us create a web page to display the password field.
<!DOCTYPE html>
<HTML>
<BODY>
<FORM>
Password: <INPUT TYPE="PASSWORD" NAME="Pass" SIZE="10">
</FORM>
</BODY>
</HTML>
Adding DataList
To provide input suggestions while allowing the user to submit input directly, use the <datalist>
element.
The <datalist> element provides a list of options for the user to select from, but it also allows the
user to enter their own input freely in an associated <input> field.
To add the data list in the form, follow the syntax as given below:
<INPUT LIST="list type" NAME="name of the list">
<DATALIST ID="Id of list">
<OPTION VALUE="Option1">
<OPTION VALUE="Option2">
<OPTION VALUE="Option3">
<OPTION VALUE="Option4">
</DATALIST>
For example:
<INPUT LIST="Countries" NAME="Country">
<DATALIST ID="Countries">
<OPTION VALUE="India">
<OPTION VALUE="China">
<OPTION VALUE="Indonesia">
<OPTION VALUE="Pakistan">
<OPTION VALUE="Bangladesh">
<OPTION VALUE="Japan">
</DATALIST>
141
More on HTML

