I’ve got a series of forms with different ids. Each one has a checkbox in there. What I am trying to do is delete one of the forms if the checkbox within it is checked.
<form id="placement-form">
</form>
<form id="placement-form1">
</form>
<form id="placement-form2">
</form>
I’ve written a short function in jQuery which should in theory delete the form if the checkbox is “checked” but I can’t get it to work. jQuery is below:
$(function() {
$('.deleteSelected').click(function() { //fire when the button is clicked
$('#placement-form:checkbox:checked').each(function() {
$('#placement-form').remove();
});
});
});
It’s probably a little muddled but I’m still getting to grips with jQuery with a combination of the documentation and a bit of Googling..!
EDIT: Though I have just realised this script will only ever search on one form (#placement-form) I’m working on it now!
try this
EDIT: Easiest way
EXAMPLE : http://jsfiddle.net/XjkHW/