我收到了错误
TypeError: "#divID".css is not a function
我不知道该怎么办才能有人帮忙?
$("#buttonID").click(function(){
console.log(( "#divID" ).css("display") == "none");
console.log(( "#divID" ).css("display"));
if($( "#divID" ).css("display") == "none"){
console.log("showing");
$("#divID").css("display", "");
} else {
console.log("hiding");
$("#divID").css("display", "none");
}
console.log(" ");
});
答案 0 :(得分:3)
你需要一美元!
console.log($("#divID" ).css("display") == "none");
等
答案 1 :(得分:1)
你必须在第2行和第3行添加$
$("#buttonID").click(function(){
console.log($( "#divID" ).css("display") == "none");
console.log($( "#divID" ).css("display"));
if($( "#divID" ).css("display") == "none"){
console.log("showing");
$("#divID").css("display", "");
} else {
console.log("hiding");
$("#divID").css("display", "none");
}
console.log(" ");
});