jQuery hide show div doesn't work in Internet Explorer

前端 未结 5 2019
青春惊慌失措
青春惊慌失措 2020-12-19 17:18

When I click togglediv, commentdiv must be visible or hidden. The following code is running on Firefox but not Internet Explorer:

5条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-19 17:54

    I would try:

    $(document).ready(function() {
      $("#togglediv").click(function() {
        // note: do this first because the :hidden test fails if you
        // do it after triggering a slow animation
        $("#togglediv").text($("#commentdiv").is(":hidden") ? "Hide" : "Sgiw");
        $("#commentdiv").toggle('slow');
      });
    });
    

    Edit: In response to your comment, this example works perfectly for me in IE7/FF3. Note: I did have to reverse the order of statements when using slow effects. Interesting!

    
    
    
      Test
      
    
    
      
    Hide
    thanks for answer. but i have tried this code, it was okay. i want to use toggle("slow") effect. this effect is runing firefox, but not i.e. is it a bug?

提交回复
热议问题