I need one help. I need to add the child element using button click in Javascript/Jquery.I am explaining my code below.
<div class="form-group" id="intro-box">
<input type="text" style="width:85%;float:left; margin-bottom:5px;" class="form-control" id="introlabelname" name="introlabelname1" placeholder="Label Name" value="">
<input type="button" class="btn btn-success btn-sm" name="minus" id="plus" value="+" style="font-size:21px; line-height:12px; border-radius:4px; margin-right:2px;margin-left:2px;margin-top:6px;" onclick="addMore();">
<input type="button" class="btn btn-danger btn-sm" name="minus" id="minus" value="-" style="font-size:21px; line-height:12px; border-radius:4px; margin-right:2px;margin-left:2px;margin-top:6px;display:none;">
</div>
<script>
function addMore(){
$('#intro-box').append('<input type="text" style="width:85%;float:left; margin-bottom:5px;" class="form-control" id="introlabelname" name="introlabelname" placeholder="Label Name" value="">');
}
</script>
Here i need , initially one text field and + button. when user will click on plus(+) button below the first text field one new text field will create with different id(i.e-introlabelname2) and one plus ,minus button will create and the first text field will remain with minus button. suppose user will click on minus button of the second text field that particular field will erase and again plus button will remain with first text field and so on. Here is my plunkr code. Please help me.
+ and -button in proper place. I have plunkr code already.+and-button in proper place"?