0
使用jQuery,如何驗證div是否存在於HTML頁面的主體中?使用jQuery在身體驗證div
使用jQuery,如何驗證div是否存在於HTML頁面的主體中?使用jQuery在身體驗證div
對於任何div的存在:
if ($("div").length > 0) {
// theres a div
}
或特定元件具有ID:
if ($("#id").length > 0) {
// it exists
}
var divExists = !!$('div').length;