hide div before
by alfannas
HTML
<div class="ini">
<input type="text" />
</div>
<label for="remove1">
<input type="checkbox" value="Remove" id="remove1" />Hide field</label>
<div class="ini">
<input type="text" />
</div>
<label for="remove2">
<input type="checkbox" value="Remove" id="remove2" />Hide field</label>
<div class="ini">
<input type="text" />
</div>
<label for="remove3">
<input type="checkbox" value="Remove" id="remove3" />Hide field</label>
CSS
label {
display: block;
}
JavaScript
var check = $('input[type="checkbox"]');
$(check).click(function() {
if ($(this).is(":checked") == true) {
$(this).parent().prev('div').hide("fast");
} else {
$(this).parent().prev('div').show("fast");
}
});