Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 3: Forms > New attributes

New attributes

As well as new input types, the <input> element has several new attributes to specify behaviour and constraints: autocomplete, min, max, multiple, pattern, and step. There’s also a new attribute, list, that hooks up with a new element to allow a new data input method.

The list attribute and <datalist>

The combination of an <input> with a list attribute and a <datalist> is a combo box—a combination of a drop-down list and a single-line textbox, that allows users to enter their own text if they don’t want to choose one of the predefined options.

The list is contained in a new <datalist> element, the id of which is referenced in the value of the list attribute:

<input id=form-person-title  type=text list=mylist>
       <datalist id=mylist>
            <option label=Mr value=Mr>
            <option label=Ms value=Ms>
            <option label=Prof value="Mad Professor">
       </datalist>


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial