Question

Today I've decided to add html5 datalist to certain input via user script. Here's the code. The problem is that list attribute isn't added. If I change it to anything different from list, like lst - it's there.

Is that supposed to be so? Is such behaviour set by specification or by browser?

Was it helpful?

Solution

OK, I did some research on this.

Spec says that input.list returns related datalist object, not the attribute value. So you should use setAttribute('list','edit-subject-themes') on input, which works fine. Seems like it was jQuery issue.

With problem solved, I'll sure use that technique in user JavaScript a lot :)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top