So I have the following HTML. The idea is that by default the user can input 2 teams, but they should have an option to add more. My add New Team function works perfectly -
what I am trying to do is allow the user to remove the inputs that they add. So they can
I'm kind of struggling how to append a "remove" button and the jQuery for that.
Here is a jsFiddle http://jsfiddle.net/sqn9Y/
All help much appreciated!
<div class="control-group">
<div id="teamArea"class="controls">
<input type="text" name="teamName[]">
<input type="text" name="teamName[]">
</div>
<a id="addNewTeam">Add another</a>
</div>
$("#addNewTeam").click(function(e) {
//Append new field
e.preventDefault();
var newField = $('#teamArea input:first').clone();
newField.val("");
$("#teamArea").append(newField);
});