2009-12-20 21 views

回答

3

對於任何div的存在:

if ($("div").length > 0) { 
    // theres a div 
} 

或特定元件具有ID:

if ($("#id").length > 0) { 
    // it exists 
} 
0
var divExists = !!$('div').length;