Baptiste
Baptiste

Reputation: 3

Change value of data-list inside an Input tag

I want to change the value of the 'data-list' attribute here :

<input id="Searchbar" data-list="Javascript,Css,Test" data-multiple/>

I tried :

Document.getElementById('Searchbar').XXXXX

All this stuff but I can't find the right way to do it.

Any suggestions?

Upvotes: 0

Views: 606

Answers (1)

Praveen Kumar Purushothaman
Praveen Kumar Purushothaman

Reputation: 167182

The document is case sensitive. Try:

document.getElementById('Searchbar').XXXXX

And to set the data-list attribute, you need to do:

document.getElementById('Searchbar').setAttribute("data-list", "new,list");

Upvotes: 4

Related Questions