Reputation: 222
I am not sure is this a bugs in jQuery when using .click()
function instead of .change()
function for checkbox. It's working well on jsfiddle
1: http://jsfiddle.net/fadlisaad/tSgbZ/16/ but not on the live page http://webcollect.viewscast.com/canonrepairmobile
You may test it with this sequence:
<INPUT TYPE="Hidden" ID="__OUTP__ResolveWay_7" NAME="__OUTP__ResolveWay_7" VALUE="">
which should be <INPUT TYPE="Hidden" ID="__OUTP__ResolveWay_7" NAME="__OUTP__ResolveWay_7" VALUE="1">
Upvotes: 4
Views: 2993
Reputation: 40497
check this:
$('input[name!="ResolveWay_7"]').click(function() {
$('input[name="ResolveWay_7"]').removeAttr('checked');
});
when you click on any input except ResolveWay_7
it clears checked
property of it (Resolveway_7
) and submit button (continue) is also an input so clicking it clears checkbox.
You need to exclude button from selection like:
$('input[name!="ResolveWay_7"]').not("input.myButton").click(.......);
Upvotes: 1
Reputation: 4844
The problem is this piece of code:
$('input[name!="ResolveWay_7"]').click(function() {
$('input[name="ResolveWay_7"]').removeAttr('checked');
});
Your Continue button is also going to satisfy that jQuery selector as it is of type <input>
and is not called ResolveWay_7. Therefore when the Continue button is clicked, it will deselect the checkbox.
Upvotes: 3
Reputation: 9172
With this code:
$('input[name!="ResolveWay_7"]').click(function() {
$('input[name="ResolveWay_7"]').removeAttr('checked');
});
you make it so that each time there's a click on an input, the checkbox is deactivated. So when you click on the submit button (yes, that's also an input) it unchecks the checkbox.
I believe you only need to change the selector to $('input[type="checkbox"][name!="ResolveWay_7"]')
and it should work.
Upvotes: 3
Reputation: 11
Look at the bottom of the source code of the page where you select "None of the above".
<script type="text/javascript">
/* <![CDATA[ */
$(document).ready(function() {
$('#comment').hide();
$('#specify').click(function() {
$('#comment').toggle();
$('textarea').val('');
});
$('input[name="ResolveWay_7"]').change(function() {
$('input[name!="ResolveWay_7"]').removeAttr('checked');
$('textarea').val('');
$('#comment').hide();
});
$('input[name!="ResolveWay_7"]').click(function() {
$('input[name="ResolveWay_7"]').removeAttr('checked');
});
});
/* ]]> */
</script>
There are 2 places there where it says:
$('input[name="ResolveWay_7"]').removeAttr('checked');
Upvotes: 1