I have activated my js file in my Yii project view:
<?php
/* Register javascript */
Yii::app()->clientScript->registerScriptFile(Yii::app()->baseUrl . '/js/showHide.js');
?>
still in my view, I have a checkBox named 'tbo_sk' and textField named 'nilaiblksk'
<?php echo $form->checkBox($model, 'tbo_sk'); ?>
<div style="display: none"><?php echo $form->textField($model, 'nilaiblksk'); ?></div>
My question is, how do we make the javascript code in my showHide.js file, to show the textField whenever I check the checkBox, otherwise hide the textField if unchecked?
In my div tag, I'm using the style="display: none" to hide textField.
Thanks in advance!