sam
sam

Reputation: 696

how to make datalist display options in html5

I have a text input with a datalist.

      <input type="text" list="languageList"/>
    	<datalist id="languageList">
    <option value="abc" />
    <option value="bac" />
    <option value="cbd" />
    </datalist>

if user type 'a' only values that start with a (in this case 'abc') is displayed. I want to display all values that has occurrence of 'a' anywhere in the value (in this case both abc and bac should be displayed).

Is it possible? If so, how to do that?

Thanks in advance

Upvotes: 1

Views: 325

Answers (2)

surendra
surendra

Reputation: 56

Default behaviour of datalist is matching will takes at any position. In your case, if you type 'a' both 'abc' and 'bac' will display. Please check the functionality again. If you had any doubt please visit below link
http://www.w3schools.com/tags/tryit.asp?filename=tryhtml5_datalist

Upvotes: 0

Renoir Reis
Renoir Reis

Reputation: 358

Maybe you are having some issues with datalist browser compatibility. See the chart below:

Datalist Browser Compatibility Chart

Source: http://caniuse.com/#feat=datalist

Hope my answer give you some help.

Upvotes: 1

Related Questions