jQuery hide show div doesn't work in Internet Explorer

前端 未结 5 1992
青春惊慌失措
青春惊慌失措 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:57

    You're missing a closing }

    Try

      $(document).ready(function(){
                 $("#togglediv").click(function(){
                    if($("#commentdiv").is(":visible")){
                    $("#commentdiv").hide("slow"); $("#togglediv").text("show");
                    }
                    else{
                    $("#commentdiv").show("slow"); $("#togglediv").text("hide");
                    }
                }
            });
    

提交回复
热议问题