0
I’m trying to make a button to remove a Dynamic field, my Add Field Button is working because I needed one to remove too so I have only button the function I could not create there
<!-- Select Basic -->
<form>
<div class="form-group" id="testescript">
<label class="col-md-4 control-label" for="txtgrupo">Tramox </label>
<div class="col-md-2">
<select id=teste class="form-control">
<option>#</option>
<option>#</option>
</select>
</div>
</div>
<div class="col-md-8">
<button type="button" id="add-campo" class="btn btn-primary">Adicionar Campo</button>
<button type="button" id="rm-campo" class="btn btn-primary">Remover Campo</button>
</div>
</form>
<br>
<script>
$("#add-campo").click(function() {
$("#testescript").append('<div class="col-md-2"><select id=cbPais class="form-control"><option>#</option><option>#</option>);
});
</script>
Didn’t work, buddy :(
– user144273
note that . field-to-be-removed is the class of the field being added dynamically. in case you do not use class but an id then change to #cbPais
– Jasar Orion
looks ex in jsfiddle that I added
– Jasar Orion