MyBlogHelp– A Blog for Digital Marketing, Affiliate Marketing, Organic Lead Generation.
  • Home
  • About
  • Contact
  • Privacy
  • Sitemap
  • BLOG
  • AFFILIATE MARKETING
    • LeadsArk
  • MORE
    • MAKE MONEY
      • ONLINE BUSINESS
      • ADSENSE
      • AFFILIATE MARKETING
    • BLOGGING
      • SEO
      • BlogSpot
      • WORPRESS
      • GOOGLE
      • COMPUTER TIPS
    • WEB DESIGN
      • HTML
      • CSS
      • BOOTSTRAP
      • JAVASCRIPT
      • JQUERY
    • WEB DESIGN
      • HTML
      • CSS
      • BOOTSTRAP
      • JAVASCRIPT
      • JQUERY
    • WEB DEVELOPMENT
      • PHP
      • WORDPRESS
  • DOWNLOADS
    • Blogger Template
    • Wordpress Theme
    • PDF

Friday, January 11, 2019

How to use datalist tag in html5?

 MyBlogHelp     January 11, 2019     html     1 comment   

Html5 datalist tag
USE OF HTML5 DATALIST TAG

HTML5 <datalist> Tag


HTML5 defines <datalist> tag to define predefined options in an <input> element. The datalist Works as an autocomplete feature for input elements. This helps in getting input faster and user experience is also improved.
For example, when you search something on Google or any other search engine, the search bar shows you the list of related terms in your query. Similar to the search engine bar, you can also create such input boxes that when the value is input by the use, show a drop-down list of related predefined options.

Many times the user unknowingly inputs incorrect information. Many types of problems can be generated from Incorrect Information. You can help the user to input the correct information by using the <datalist> tag. Whenever the user tries to type an input, then the list of already defined options is displayed. The user can choose the option from this list. In this way, you can avoid typing mistakes of the user.

The <input> element and <datalist> element must be bond together to show the list of predefined options. For this, the list attribute is defined in the <input> element. In an <input> element, the list attribute is used to define the related list of the element. In this attribute, you can pass the id value of the <datalist> element.

Browser Compatibility

         All browsers don’t support the <datalist> tag. This tag is not supported by Apple Safari and Internet Explorer. This element does not support older versions of other browsers.

          1. Google Chrome - 20.0
          2. Firefox - 4.0
          3. Internet Explorer - 10.0
          4. Opera - 9.0
          5. Safari - Doesn't Support

Syntax of HTML5 <datalist> Tag

The general syntax for <datalist> tag is given below.

<input type = "text" name = "Name_Id" list = "Datalist_Id">
<datalist id = “Datalist_Id">
<option value = "option-1">
<option value = "option-2">
.....
<option value = "option-n">
</ datalist>

As you can see in the syntax above, the value of the list attribute in the <input> element and the value of the id attribute in the <datalist> element will be same. The <option> tag is used to define the options in <datalist>. In the <option> tag's value attribute, you can define the value that you want to show as a list.

Attributes of HTML5 <datalist> Tag

<datalist> supports all the global and event attributes of HTML such as id, class, onload, onpageshow, ononline etc.

How to use datalist tag in html5?

Example of HTML5 <datalist> Tag

<!DOCTYPE html>
<html> 
    <head>
<title> Example of HTML5 datalist </title>
   </head>
    <body>

         <form>            
      <input type="text" name="countrySearch" list="CountryNameList" placeholder="Search Country Name">
                                    <datalist id = "CountryNameList">
                                                <option value = "America">
                                                <option value = "Russia">
                                                <option value = "China">
                                                <option value = "France">
                                                <option value = "England">
                                                <option value = "Australia">
                                                <option value = "Germany">
                                                <option value = "India">
                                    </datalist>

        </form>

</body>

</html>

The above example produces the below output.


 
datalist-Tag-example
HTML5-datalist-Tag-example


    << PREVIOUS                                                                                        NEXT >>




  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

1 comment:

  1. aaronnssdSeptember 9, 2019 at 10:20 PM

    sdgh

    ReplyDelete
    Replies
      Reply
Add comment
Load more...

Thank you for reading this post. Please do not enter any spam link in the comment box.

Followers

Blog Archive

  • ►  2020 (4)
    • ►  October (1)
    • ►  September (1)
    • ►  August (2)
  • ▼  2019 (52)
    • ►  December (1)
    • ►  November (2)
    • ►  October (1)
    • ►  August (1)
    • ►  July (1)
    • ►  May (11)
    • ►  April (10)
    • ►  March (6)
    • ►  February (3)
    • ▼  January (16)
      • What is bootstrap and its major advantages of crea...
      • What is CSS? CSS Tutorial 01
      • How to use input attributes in html5?
      • How to use input type in html5?
      • How to use output tag in html5?
      • How to use keygen tag in html5?
      • How to use datalist tag in html5?
      • How to use svg tag in html5?
      • How to use canvas tag in HTML5?
      • How to use the track tag in html5?
      • How to use source tag in html5?
      • How to use embed tag in html5?
      • How to use the main tag in html5?
      • How to use Ruby tag in html5?
      • How to use html5 mark tag to highlight text?
      • How to use html5 footer tag?
  • ►  2018 (54)
    • ►  December (27)
    • ►  November (5)
    • ►  May (5)
    • ►  April (4)
    • ►  February (3)
    • ►  January (10)
  • ►  2017 (17)
    • ►  December (9)
    • ►  November (8)

Popular Posts

  • How to use the main tag in html5?
  • How to use keygen tag in html5?
  • How to use html5 mark tag to highlight text?
  • How to start Online Business without money from home?
  • What is a search engine?

Contact Us

Name

Email *

Message *

About MyBlogHelp

Most of the posts, we share on this blog related to Affiliate Marketing, Organic Lead Generation, Digital Marketing, Social Media Marketing, Make Money Online, SEO, and web design.

Featured Post

LeadArk - Affiliate Marketing | Qualified Organic Lead Generation | LeadsArk Review

Copyright © MyBlogHelp– A Blog for Digital Marketing, Affiliate Marketing, Organic Lead Generation.
Design by Md. Abdussamad | MyBlogHelp.com