I have this code that when the user will click the Add button a Textbox will appear. But what I want to implement is to remove the textbox that was appended individually by clicking a button:
<div class="form_group">
<div id="p_scents">
<a class="btn btn-warning btn-sm" onclick="addAffiliate()">+ Add Merchant ID</a><br>
<a class="btn btn-warning btn-sm" onclick="deleteAffiliate()">+ Remove Merchant ID</a><br>
<p></p>
</div>
</div>
My Javascript is:
function addAffiliate() {
var scntDiv = $('#p_scents');
var i = $('#p_scents p').size() + 1;
$('<p><label for="p_scnts"><input type="text" required="true" id="p_scnt" size="30" class="form-control" name="merchant[]" value="" placeholder="Input MerchantID" /></label> </p>').appendTo(scntDiv);
i++;
}
My deleteAffiliate function is where I want to delete a single textbox that was appended before.