I am trying to set a radio button to Yes or No depending on whether or not a textarea is blank or not.
$(document).ready(function(){ $('.controlledDocuments textarea').change(function(){ if($(this).val() == '') { $('#Field60-0').attr('checked', false); //Yes is unchecked $('#Field60-1').attr('checked', true); //No is checked } else { $('#Field60-0').attr('checked', true); //Yes is checked $('#Field60-1').attr('checked', false); //No is unchecked } }); }); //close document.ready
I'm defaulting the radio button to "No".
When I type something in the field and press TAB, it does change to "Yes" (yay, one win!).
But when I go back up and delete the text, press TAB, it removes the "Yes" but doesn't set the radio button to "No".
Whatever could I be doing wrong????