From what I can say, having read everything I can find here, this seems impossible, but I just thought that I would ask.
What I want to do is to prevent the checkbox from performing the default action to switch and run the function. This function must know the CURRENT state flags - as opposed to the state it will be in after the click event has switched, and so that this switch is prevented.
So let's say I have this input, for example
<input type="checkbox" onclick="setDefault(this);return false;" />
And the setdefault function looks something like this:
function setDefault(el) {
if(jQuery(el).is(':checked'))
{
alert('Turning current default off- setting default to Home settings');
jQuery(el).prop('checked',false);
return;
}
else
{
alert('setting a new default');
jQuery(el).prop('checked',false);
return;
}
}
When this starts, it gets the status the checkbox has been changed to, and what I need is for it not to change the status, find out its current status and then decide what to do.
preventDefault() false. , onclick, onchange .. .., , , , , , .
, , - , ,