Jquery有问题,必须双击才能切换,你能告诉我为什么吗?


Jquery issue, have to double click for the toggle to occur, can you tell me why?

一切正常

jQuery:

$(".edit").click(function()
{
    var user_id=$(this).attr('id');
     var options = '';
        $.getJSON("do_find_courses.php",{user_id:user_id}, function(data){
          for (var i = 0; i < data.length; i++) {
              if(data[i].optionDisplay=="No File Categories")
              {
                  options = '<option disabled="disabled" selected="selected">No products</option>';
              }
              else
              {
                  options +=' <input name="' + data[i].optionValue + '" type="checkbox" value="' + data[i].optionDisplay + '" />'+ data[i].optionDisplay +'<br>';
            //options += '<option value="' + data[i].optionValue + '">' + data[i].optionDisplay + '</option>';
              }
          }
          $("#chkbox"+user_id).slideToggle( "slow" ).html(options);
          //$("#chkbox"+user_id).html(options);

        });
     return false;

 });

php代码生成的一个href

 <?php
                            $get_students=mysql_query("SELECT user_id ,surname,name, admin FROM users WHERE users.admin=0 ORDER BY users.surname ASC") or die(mysql_error());
                    while($row=mysql_fetch_array($get_students))
                        {
                            echo'       
                            <tr>
                                <td><h3>'.$row['surname'].'</h3></td>
                                <td>'.$row['name'].'</td>
                                <td><div id="chkbox'.$row['user_id'].'"></div></td>
                                <td><a href="'.$row['surname'].','.$row['name'].'" class="ico del" id="'.$row['user_id'].'">Delete</a>
                                <a href="edit" id="'.$row['user_id'].'" class="ico edit">Edit</a></td>                          
                            </tr>';}
                ?>
$(document).ready(function{
    $(".edit").unbind('click');
    $(".edit").click(function(){ bla bla bla});
});