Issue in displaying div for checked checkbox in form

This is my checkbox in my form.

    <div id="check" class="form-group">
              <input type="checkbox" name="carry_forward" id="carr" value="1" <?php if( $row[0]->carry_forward == 1) echo 'checked';?>>&nbsp;&nbsp;Carry Forward leave
        </div>

This is my jquery for on changing checkbox which is working

                $("input[name=carry_forward]").change(function(){
if($(this).prop('checked')){
	//alert('checked');
	$('#start_time1').show();
}else{
	$('#start_time1').hide();
	//alert('unchecked');
}
  });

but while editing the form the checkbox is showing that it is checked but the div i.e start_time1 is not showing up even if the checkbox is checked ,
How can I do that ?

Currently the code only runs when the input field changes.
So, you can trigger the change event to cause it to run.
http://api.jquery.com/trigger/

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.