I have a radiobutton set called daypattern . Clicking on it should enable the checked member s formfield siblings and disable the formfield siblings (if any) of other members. I am trying to compare the value of the checked field with the value of the current radio button but the checked field value is returning an integer rather than the expected string from the radio button s value attribute.
Where is it getting this number? How can I fix it and is there a better approach?
Thanks
problem function:
$.fn.setActiveState=function(){
var c=$(this+ :checked ).val();//c=3 instead of everyday OR everywday . WHY?
this.each(function(){
alert(c + and + $(this).val());//3 and everyday OR everywday
if($(this).val()== c){
$(this).siblings( :input ).removeAttr("disabled");
}else{
$(this).siblings( :input ).attr( disabled ,true);
}
});
}
HTML
<label>
<input type= radio name= daypattern value= everyday checked= checked />Every
<input type= text class= numtext name= day_increment value= 1 /> day(s)
</label>
<label>
<input type= radio name= daypattern value= everywday />Every weekday
</label>
call problem function in $(document).ready
:
$("input[name= daypattern ]").setActiveState();