#767268 by sun, rfay: Fixed #states doesn't work correctly with radio buttons.

merge-requests/26/head
Angie Byron 2010-04-30 19:30:44 +00:00
parent 682ad44a50
commit c1bb8d1ecd
1 changed files with 11 additions and 0 deletions

View File

@ -247,11 +247,22 @@ states.Trigger.states = {
}
},
// For radio buttons, only return the value if the radio button is selected.
value: {
'keyup': function () {
// Radio buttons share the same :input[name="key"] selector.
if (this.length > 1) {
// Initial checked value of radios is undefined, so we return false.
return this.filter(':checked').val() || false;
}
return this.val();
},
'change': function () {
// Radio buttons share the same :input[name="key"] selector.
if (this.length > 1) {
// Initial checked value of radios is undefined, so we return false.
return this.filter(':checked').val() || false;
}
return this.val();
}
},