简体   繁体   中英

Input datalist not working in hyperscript

I am using the following library: https://github.com/hyperhype/hyperscript

The following code:

h('input', { list: "list-id"}),
h('datalist', { id: "list-id" }, [
    h('option', ["Option 1"]),
])`

results in:

<input>
<datalist id="list-id">
    <option>Option 1</option>
</datalist>

The input element lacks the list property ie It should look like <input list="list-id">

What am I doing wrong?

I managed to solve it with:

h('input', { attributes: { 'list': "list-id" } })
h('datalist', { id: "list-id" }, [
    h('option', ["Option 1"]),
])`

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM