Friday, February 27, 2015

OnChange event wont work in cakephp

Hi, I cant get any onchange event to fire. I just want to disable a textbox when some  options are selected.

I used id  and name in textbox but I cant get thus to work as when i click the radio button nothing changes.
I used radio buttons


echo $this->Form->input('startDate',array('id'=>'startdatebox','label' => 'Start Date','class'=>'datepicker', 'type'=>'text','style'=>'width:100px;height:30px','value' => $datestart));           echo '</td>';               echo '<td>';            echo $this->Form->input('endDate',array('id'=>'enddatebox','label' => 'End Date','class'=>'datepicker', 'type'=>'text','style'=>'width:100px;height:30px','value' => $dateend));               echo '</td>';                 echo $this -> Form -> input('dateRange',                  array('id'=>'dateRange','label' => '<h6>Date Range</h6>','type' => 'radio', 'value' =>$dateSelect,'options' =>  $selectoption));           <script type="text/javascript">    $(document).ready(function() {      $('#dateRange').change(function() {          if ( $(this:'checked').val() != 3 )          {              $('#startdatebox]').prop('disabled', true);              $('

No comments: