According to the other stackoverflow posts on this, this should work. Yet it doesn't really. This is the code. Pretty basic just for testing.
HTML:
<form>
<div id="inputs">
<p><input type="text" id="user" /></p>
</div>
<hr />
<input type="button" value="Add Another Row" class="add" id="add" >
</form>
And JQuery:
<script>
$(function() {
var node = "";
var count = 0;
$('#add').on('click', function() {
$node = '<p><input type="text" id="' + count + '"><a href="#" class="remove">Remove Number' + count + '</a></p>';
count++;
$('#inputs').append(node);
});
$('.remove').on('click', function() {
$(this).parent().remove();
return false;
});
});
</script>
What's weird is that the Add Field function works on my browser. Yet I put the same code into JSFiddle and it wouldn't work there. The remove function doesn't work at all, either in my browser or in JSFiddle. I'm still learning JQuery and Javascript in general, so any assistance in helping me learn would be much appreciated. Thanks!