jQuery Plugin - Radio button with Checkbox Behavior - Updated March 6, 2008
I found some bugs in my jQuery plugin I have published recently. So here is the bugfix release for the same.
You can download it here.
Click here to see Demo: Radio with Checkbox Behavior Live in Action
Following bugs/issues are resolved.
Change Log:
- Compatibility will be with jQuery 1.2.3 or newer.
- jQuery chain will not break.
- Bug related to multiple radios is solved.
- Now using data() function from jQuery 1.2.3
- If radios are checked while page is getting loaded then it was required to click twice to uncheck.
- Tested on IE, Firefox, Safari.
Download Here
jQuery Plugin - Radio button with Checkbox Behavior - Updated…
[...]Ever wanted Radio-buttons having Checkbox behavior..?
I mean Radio-buttons which you can click and CHECK and once again click and UNCHECK.
Here is a jQuery plug-in which will let you do with just single line of code.[...]…
Better try this as the above I think have some problems (anywai in FF I saw it, try use mouse/keyboard to see what I mean)
Here it is:
$.fn.extend({
triState:function(){
return this.each(function(){
$(this).data(’status’, $(this).attr(’checked’));
$(this).focus(function(){ $(this).data(’status’, $(this).attr(’checked’)); });
$(this).blur(function(){ $(this).data(’status’, $(this).attr(’checked’)); });
$(this).mousedown(function(){ $(this).data(’status’, $(this).attr(’checked’)); });
$(this).keydown(function(){ $(this).data(’status’, $(this).attr(’checked’)); });
$(this).click(function(){
if ($(this).data(’status’))
$(this).attr(’checked’, false);
$(this).data(’status’, $(this).attr(’checked’));
});
});
}
});
It’s working good on (tested) FF, IE(7 anyway, still may be a little problem there), Opera, Safari (for Win).
P.S. Use as (where “radioid” is the ID used by radio buttons…)