Skip to main content

learn html 5 Forms Pt. 2: Attributes and Data Lists

More attributes

As well as those attributes mentioned, both here and in earlier guides, there is a handful of additional attributes:

Placeholder text

The placeholder attribute can be used with text input fields (and their text-like cousins, such as type="email" and type="number") as well as textarea elements. It is intended as ahint, rather than a label, for which a labelelement should still be used.

<label for="email_address">Email address</label>
<input type="email" placeholder="you@somewhere.com" name="email_address" id="email_address">

Autofocus

You might want focus to land on a form field when a page loads. If you think of a search engine, for example, when you land on its home page you don’t normally need to click on the search box to start typing - you can do so straight away because it already has focus. Theautofocus attribute is a quick way to achieve this effect.

<input name="query" autofocus>

Data lists

A data list takes the form of a list of suggestionsthat accompanies a text field:

<input name="country" list="country_name">
<datalist id="country_name">
    <option value="Afghanistan">
    <option value="Albania">
    <option value="Algeria">
    <option value="Andorra">
    <option value="Armenia">
    <option value="Australia">
    <option value="Austria">
    <option value="Azerbaijan">
    <!-- etc. -->
</datalist>
The value of the list attribute in the inputelement (which could be any of the text-like input types) binds it to a datalist element with the corresponding ID (“country_name”, in this example). As a user types in the text field, if what they type matches the start of anything in the data list, those matches will be shown underneath the text field as suggestions. So, here, if “A” is typed, the 8 countries beginning with “a” are displayed. If “L” is typed after “A”, the list of suggestions will reduce to just “Albania” and “Algeria”, and so on. The data sent when the form is submitted will be whatever is in the text field - it could be something selected from the list or it could be something completely different, inputted by the user.




Popular posts from this blog

Free tips to save yourself from phishing

Free tips to save yourself from phishing Phishing is a type of social building method utilized by programmers to assemble delicate data, for example, usernames, passwords and Visa points of interest by acting like a trustworty individual/association. Since most online clients are ignorant of the methods utilized as a part of completing a phishing assault, they regularly fall exploited people

Free internet browser download :internet explorer

Internet explorer full free downloads Internet explorer 11.0.11 full free download Internet explorer 10.0 full free download Internet explorer 9.0 full free download internet ex plorer lastest version download these are the lastest version of internet explorer...if you want anything else then let me by sending me comment i will try my best to give that...............

tricks to Hack an Email using Hardware Keylogger

tricks to Hack an Email using Hardware Keylogger Equipment Keyloggers are utilized for keystroke logging, a system for catching and recording machine client keystrokes. They connect to between a machine console and a machine and log all console action to an inward memory. They are intended to work with PS/2 consoles, and all the more as of late with USB consoles. An equipment keylogger seems just as a USB pendrive (thumb drive) or some other machine fringe so that the victimized people can never