I have the following code that I am trying to get. I want the rows of the table with the class generator to be displayed if the checkbox is checked and removed if it is not set (by default). I tested jquery and I know that it loads normally, so this is not a problem.
Below is my code that I was trying to adapt from jQuery flag event handling :
<script> $('#gen_form input:checkbox').click(function() { var $this = $(this); </script> <?php if(isset($msg)){ echo "<span id='msg'>".$msg."</span>"; }?> <h2>Add CLLI</h2> <form method="post" id='gen_form'> <table class="form_table_newuser"> <tr> <td class='tdl'>Generator</td><td class='tdr'><input type='checkbox' id='showGen' name='generator' /></td><td> </td> </tr> <tr class='generator'> <td class='tdl'>Start Time</td><td class='tdr'><input type='text' name='start_time' class='textbox'/></td><td> <span class='error'>*<?php echo $errors['start_time']; ?></span></td> </tr> <tr class='generator'> <td class='tdl'>End Time</td><td class='tdr'><input type='text' name='end_time' class='textbox'/></td><td> <span class='error'>*<?php echo $errors['end_time']; ?></span></td> </tr>
I'm still pretty new to jQuery and am learning. Everything I tried with checking the checkbox failed. I can use the button and it worked (with a different code), but I have to use this checkbox. I tried a few more things before posting them, which say that they all deal with the flag, but none of them did anything at all by clicking the flag.
source share