[英]How to add value to dynamic input box in javascript
I am Creating one input box dynamically using javascript 我正在使用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";
如果我以静态方式添加值,则需要使用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);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.