How to add Textbox infront of label in javaacript | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to add Textbox infront of label in javaacript

16th Jul 2018, 1:52 AM
Snehal Hajare
Snehal Hajare - avatar
6 Answers
+ 1
do you mean an input tag?
16th Jul 2018, 3:10 AM
Lemuel
Lemuel - avatar
+ 1
do you want the javascript to create an input tag?
16th Jul 2018, 3:12 AM
Lemuel
Lemuel - avatar
+ 1
try: for (var i = 0; i < document.getElementsByTagName("label").length; i++) { var input = document.createElement("input"); document.getElementsByTagName("label")[i].appendChild(input); }
16th Jul 2018, 3:16 AM
Lemuel
Lemuel - avatar
0
yes Sir
16th Jul 2018, 3:12 AM
Snehal Hajare
Snehal Hajare - avatar
0
actually I am getting label dynamically....In MVC....and need to append Textbox in front of each label
16th Jul 2018, 3:12 AM
Snehal Hajare
Snehal Hajare - avatar
0
success: function (response) {   if (response.length != 0) {                     $.each(response, function (key) {                                                $("#divAwardStages").append("<label>" + response[key].StageName + "</label>");                                           });                 }                   }         });     };
16th Jul 2018, 3:56 AM
Snehal Hajare
Snehal Hajare - avatar