代码如下:

var elements=$(".myclass");
//length>0则说明获取到了元素对象,否则未获取到 if(elements.length>0)){ alert("exist"); } else{ alert("not found"); }

  

相关文章: