Example
Have a play with both the checkbox and radio sections to notice the problem.
I'm trying to remove the fakeradioed class from all radios that are unselected by another radio being selected.
Code:
$(document).ready(function(){
// check for what is/isn't already checked and match it on the fake ones
$("input:radio").each( function() {
(this.checked) ? $("#fake"+this.id).addClass('fakeradioed') : $("#fake"+this.id).removeClass('fakeradioed');
});
// function to 'check' the fake ones and their matching checkboxes
$(".fakeradio").click(function(){
($(this).hasClass('fakeradioed')) ? $(this).removeClass('fakeradioed') : $(this).addClass('fakeradioed');
$(this.hash).trigger("click");
return false;
});
});
Any suggestions on how i can fix this?