I'm trying to create dynamycally some datalists. My problem happen when I try to embed it in an input. I tried this code but newinput.list="DL"
doesn't work. ()
var newinput = document.createElement("input");
newinput.className="nom";
newinput.id= file_header[i];
newinput.type= "text";
newinput.list="DL";
document.getElementById("head_menu").appendChild(newdiv);
Input is created but without list
attributes... Can someone explain me how to link my input with my datalist?
Try what @David is saying .. it worked for me.
newinput.setAttribute('list', 'DL');
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.