Can't comment directly on above solution but I found that even though it seems like this would work, it doesn't. When the alert() function is called in the example it DOES blocks the processing of the mousedown event but if you remove the alert() and put in some other sort of non-blocking code, the radio button click still fires. This is the simplest solution I could come up with to stop it:
/******************************************************************
This code snippet allows you to Select and Unselect a radio button
******************************************************************/
//Var to store if we should not process
var block = false;
//This handles the mousedown event of the radio button
$(function()
{
$('input[type=radio][id*="rb_Status"]').mousedown(function(e)
{
//If the radio button is already checked, we uncheck it
if($(this).prop('checked'))
{
//Uncheck radio button
$(this).prop('checked',false);
//Set the flag to true so click event can see it
block = true;
}
})
});
//This handles the click event of the radio button
$(function()
{
$('input[type=radio][id*="rb_Status"]').click(function(e)
{
//If the flag was just set to true in the mousedown event, stop processing
if(block)
{
//Reset the flag for next time
block = false;
//Return false to stop the current click event from processing
// Might need these depending if you have other events attached:
// e.stopImmediatePropagation() / e.preventDefault() / e.stopPropagation()
return false;
}
})
});