Reputation: 544
I'm generating fields dynamically but I need to add a id in the middle of the string that will be the input.
var id = uid();
$(wrapper).after('<div> <input class="form-control" type="text"name="mytext[]"/>').after('<a href="#" class="remove_field">Remove</a></div>');
But it only works if the after
is used in the final of enclose tag.
Upvotes: 0
Views: 44
Reputation: 4472
Solved here:
$(wrapper).after('<div> <input class="form-control" value="'+id+'" type="text" name="mytext[]"/><a href="#" class="remove_field">Remove</a></div>');
Upvotes: 1