in html , javascript code below, wish add text field , radio button dynamically when click button. working properly. want new text field generated should have same font size , appearance 1 above it, i.e. want have same class.
here html:
<input type="radio" name="choices" value="o1"/> <input type="text" name="o1" id="o1" class="inputtype"/> <span class="file-wrapper"> <input type="file" name="o1_i" /> <span class="button">choose file</span> </span> <div id="responce"></div>
and javascript:
var div = document.getelementbyid("responce"); var radio = document.createelement("input"); radio.type = "radio"; radio.name = "choices"; radio.value = "o" + countbox; div.appendchild(radio); var text = document.createelement("input"); text.type = "text"; text.id = "o" + countbox; text.name ="o" + countbox; div.appendchild(text); var upload = document.createelement("input") upload.type = "file"; upload.name= "o" + countbox + "_i"; div.appendchild(upload);
just set classname
property in same way you're setting name, type , id:
text.classname = "inputtype";
do same browse button:
upload.classname = "someclass";
for multiple classes, separate them space. note classname
overwrites whole class list.
Comments
Post a Comment