im trying to uncheck a jquerymobile checkbox with jquery.
im trying to uncheck it when a person clicks on a button.
this is me checkbox:
<input id='_inputcb_Q801' name='_inputcb_Q801' type='checkbox'>
<label id='_inputcb_Q801L' for='_inputcb_Q801'>Text</label>
and i have tried those options.
function uncheckCB(){
$('#_inputcb_Q801').prop('checked',false).checkboxradio('refresh');
$('#_inputcb_q801').not(:checked);
$('input[type=\"checkbox\"]:first').attr('checked', false).checkboxradio('refresh');
$('input[name=_inputcb_Q801]').attr('checked',false);
$('input[name=_inputcb_Q801]').prop('checked', false);
}
the function is a onclick of a button.
none of the above options work.
anyone knows another way to uncheck a jquerymobile checkbox.
thanks in advance
This works:
Probably it doesn’t work for you because you have javascript errors. Try to inspect your code in browser.
See in action here: http://jsfiddle.net/eH7Fn/2/
Please also read on .prop() vs .attr()
Edit:
the jsfiddle you’ve provided (http://jsfiddle.net/pjottard/97uMb/) doesn’t work for several reasons:
1.you used mootools as a library, but you need to select Jquery
2. you didn’t define function: priceCounterCB();
3. you didn’t provide
hrefattribute for your link to be clickable. you need to addhref="#"to your link or better yet use button.working example: http://jsfiddle.net/97uMb/1/