Error Using Javascript With Radio Buttons

Hello everyone,

i have a radio button to select the marital status of an employee, depending on the selection i disable or enable a textfield (spouse)

my javascript code:-




<?php

    Yii::app()->clientScript->registerScript('checkscript','





$("#Academicstaff_spouse").attr("disabled",true);


$("#Academicstaff_marialStatus").change(function()

    {

        if($(this).val() == "Unmarried") 

        {

        $("#Academicstaff_spouse").attr("disabled",true);

        } 

        else if($(this).val() == "Married") 

        {

      $("#Academicstaff_spouse").attr("disabled",false);

    }

  });',CClientScript::POS_READY);

?>



This will make the textfield disable at startup but will not change on selection,

I had an alert on my javascript as:-

alert($("#Academicstaff_marialStatus").val()); which did not return any value

my view code for radio button




<?php

$model->marialStatus='Married';

$marital_status = array('Married' => 'Married', 'Unmarried' => 'Unmarried'); //declaration

echo $form->radioButtonList($model, 'marialStatus', $marital_status, //using the declared array

array('separator' => ' ', 'labelOptions' => array('style' => 'display:inline')));

?>



I had another camel case radio button, i tried to fix a value to that and alert too, which did not work…

Can someone help me fix this?

Or cant we use javascript with radiobuttons in this case?

Any help is appreciated…

Thanks a lot…

Cheerz! :)