jquery - store and duplicate input changing id x times -
Hi friends, I was the best way to overcome this:
I have will generate: You can use . Fields are hidden, here's a screenshot of what has been generated: Input element within a hidden area
div Get the
input with
id = 'upload_logo' on the page load, then generate the x amount of time and add it to the same
div < Once / code> updating
names and
id each time.
& lt; Div id = "hidden_fields" & gt; & Lt; Input type = 'hidden' class = 'hidden' name = 'upload_logo' id = 'upload_logo' value = 'filepath / filename.eps' / & gt; & Lt; / Div
& lt; Div id = "hidden_fields" & gt; & Lt; Input type = 'hidden' class = 'hidden' name = 'upload_logo' id = 'upload_logo' value = 'filepath / filename.eps' / & gt; & Lt; Input class = "hidden" type = "hidden" id = "upload_logo_x" name = "upload_logo_x" value = "filepath / filename.eps" & gt; & Lt; Input class = "hidden" type = "hidden" id = "upload_logo_x" name = "upload_logo_x" value = "filepath / filename.eps" & gt; & Lt; Input class = "hidden" type = "hidden" id = "upload_logo_x" name = "upload_logo_x" value = "filepath / filename.eps" & gt; & Lt; / Div
for loop For this, have it. Your
hidden_filld is your
#hidden_fields element,
upload_logo is your
#upload_logo element and
number The number of elements that you want to create.
var hidden_fields = $ ('# hidden_fields'), upload_logo = $ ('# upload_ logo'), number = 3; (Var i = 0; i & lt; 3; i ++) $ ('& lt; input / & gt;', {type: 'hidden', 'class':' hidden ', id:' upload_logo_ '+ I, name:' Upload_logo_ '+ i, value: upload_logo.val ()}). Enclosure (Hidden_field);
Comments
Post a Comment