Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要检查有多少 div 具有特定的“可见”类。我这样做了,但这显然是错误的:
var select = $(".container div:not(.row)").hasClass("visible"); alert("there are " + select.length + "divs with the class visible");
我怎样才能实现我想要做的事情?
一次完成:
alert("there are " + $(".container div.visible:not(.row)").length + "divs...");
像这样试试。
alert("there are " + $(".visible").size() + " divs with the class visible");