当我点击时togglediv
,commentdiv
必须是可见的或隐藏的.以下代码在Firefox上运行,但不在Internet Explorer上运行:
$(document).ready(function(){
$("#togglediv").click(function(){
if( $("#commentdiv").is(":visible") ) {
$("#commentdiv").hide("slow");
$("#togglediv").text("show");
} else {
$("#commentdiv").show("slow");
$("#togglediv").text("hide");
}
});
});
Run Code Online (Sandbox Code Playgroud)