I created a simple multi-text input with jQuery, appending text fields working fine. But, struggling to remove them. I googled, checked past questions but, don't know how to match them to my code.
Here is my code
$(document).ready(function () {
var i = 1;
(function () {
$('.dd').on('click', '.addRow', function () {
i = i+1;
var start = $('#fields'),
newRow = $('<input type="text" name="i" class="quantity" /><p class="xx">X</p><br><br>');
$(start).append(newRow);
});
})();
});
HTML
<div class="dd">
<form action="js-more-fields.php" method="get">
<div id="fields">
</div>
<p class="addRow">Add a Row</p>
<input type="submit" id="submit" />
</form>
</div>