I have written following code to set the status of the image button to enable disables modes
using JQuery.
following is the code for check box in yii format
<?php echo CHtml::CheckBox('TermsAgreement','', array ('checked'=>'unchecked','value'=>'on', )); ?>
this code produce input element as follows.
<input value="on" type="checkbox" name="TermsAgreement" id="TermsAgreement">
Then i have image button code as follows in yii format
<?php echo CHtml::imageButton('/mactorget/images/procceed.png', array ('disabled'=>false, 'id'=>'procceed')); ?>
Above code produce following image button input element
<input id="procceed" src="/mactorget/images/procceed.png" type="image" name="yt0" value="submit">
Now i want to set the enable disable modes of image button based on checkbox status.
to do that i have written following code sample
Yii::app()->clientScript->registerScript(
'change',
'$("#TermsAgreement").change(function () { if($("#TermsAgreement").attr("checked")){ document.getElementById("procceed").getAttribute("disabled")=false; }else{ document.getElementById("procceed").getAttribute("disabled")=true; }});'
);
but this does not set the status of the image button element.
Could anybody having experience/knowledge in this issue share your ideas with me. Thanks in advance for any help
Improved version of your code:
All together: