0% found this document useful (0 votes)
15 views

HTML5 Added Several New Input Types

The document discusses new input types and attributes that were added in HTML5 such as color, date, datetime, email, number and range. It also covers using the <datalist> tag to define predefined options for a search field and examples of creating email, url and telephone number input fields. Custom table names or "nicknames" can also be used to shorten join statements in SQL queries.

Uploaded by

Java Jimmy
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views

HTML5 Added Several New Input Types

The document discusses new input types and attributes that were added in HTML5 such as color, date, datetime, email, number and range. It also covers using the <datalist> tag to define predefined options for a search field and examples of creating email, url and telephone number input fields. Custom table names or "nicknames" can also be used to shorten join statements in SQL queries.

Uploaded by

Java Jimmy
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

NAME LOCATION CONTACT

Ocan Jimmy Uganda +2567852937811


Benito Musolini Italy +2431290190772
Kwezi aloysious Uganda
Alonso Pilate Italy +246575456767

HTML5 added several new input types:


- color
- date
- datetime
- datetime-local
- email
- month
- number
- range
- search
- tel
- time
- url
- week

New input attributes in HTML5:


- autofocus
- form
- formaction
- formenctype
- formmethod
- formnovalidate
- formtarget
- height and width
- list
- min and max
- multiple
- pattern (regexp)
- placeholder
- required
- step
<form autocomplete="off">
<label for="e-mail">Your e-mail address: </label>
<input name="Email" type="text" required />
<input type="submit" value="Submit"/>
</form>

<input id="mysearch" name="searchitem" type="search" />

You must remember to set a name for your input; otherwise, nothing will be submitted.

Search Options

The <datalist> tag can be used to define a list of pre-defined options for the search field:
<input id="car" type="text" list="colors" />
<datalist id="colors">
<option value="Red">
<option value="Green">
<option value="Yellow">
</datalist>

<option> defines the options in a drop-down list for the user to select.


The ID of the datalist element must match with the list attribute of the input box.

Creating More Fields

Some other new input types include email, url, and tel:


<input id="email" name="email" type="email" placeholder="[email protected]" />
<br />
<input id="url" name="url" type="url" placeholder="example.com" />
<br />
<input id="tel" name="tel" type="tel" placeholder="555.555.1211" />

Custom Names
Custom names can be used for tables as well. You can shorten the join statements by
giving the tables "nicknames":

SELECT ct.ID, ct.Name, ord.Name, ord.Amount


FROM customers AS ct, orders AS ord
WHERE ct.ID=ord.Customer_ID
ORDER BY ct.ID;
As you can see, we shortened the table names as we used them in our query.

You might also like