简体   繁体   中英

How to add value to dynamic input box in javascript

I am Creating one input box dynamically using javascript

Below is the Code:

var addtxt = document.createElement("input");
addtxt.type = "text";
addtxt.name = "admissionno" ;
addtxt.id = "admissionno" ;

If i add value in static way it will take using addtxt.value="11"; But am adding like this dynamically

addtxt.value=result.studentlist[j].admissionno

it will not work.please give me the idea its helpful for me.

尝试这个:

document.getElementById("admissionno").value = (result.studentlist[j].admissionno);

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