Vote count: 0
I am looking to add and remove duplicate input fields using Jquery-
This is my HTML:
<div class="col-sm-9">
<div class="input_wrap">
<div><input type="text" name="text[]" class="form-control"></div>
// **** Here I want to add div using Jquery **** //
<button class="add_field_button btn btn-info">Add More Subcategory</button>
</div>
</div>
This is my Jquery:
var wrapper = $(".input_wrap");
var add_button = $(".add_field_button");
$(add_button).click(function(e){
e.preventDefault();
$(wrapper).prepend('<div><input type="text" name="text[]" class="form-control"><a href="#" class="remove_field">Remove</a></div>'); //add input box
});
When I using this Jquery its always add div
below the .input_wrap
DIV. But I want to add DIV
to the place I have shown in my HTML Code.
Hope somebody may help me out. Thank you.
asked 1 min ago
Add/Remove Input Fields Dynamically with jQuery
Aucun commentaire:
Enregistrer un commentaire