So I'm trying to submit a form in jquery to hide or show stuff.
But it doesn't work after submitting again.
Html:
<form id="filters" href="#">
<table id="filter" class="table">
<thead>
<tr>
<th>Show/Hide</th><th>Column</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<input type="checkbox" name="checkNumber" value="1"/>
</td>
<td>
Account Number
</td>
</tr>
</tbody>
</table>
</form>
Jquery:
$(function() {
$('#filters').submit(function() {
if ($('input[name=checkNumber]').attr('checked') == true) {
$('input[name=search_account]').show("normal");
}
else if ($('input[name=checkNumber]').attr('checked') !== true) {
$('input[name=search_account]').hide("normal");
}
return false;
});
});
I've tried so many other ways, but it all works the same. I submit, it hides the right input tag but when I resubmit to show it, it doesn't work.
It also doesn't work if I submit it with the checkbox checked.
Any help will be appreciated!