http://learn.jquery.com/using-jquery-core/faq/how-do-i-test-whether-an-element-exists/

if ( $( "#myDiv" ).length ) {
    $( "#myDiv" ).show();
}

http://www.jb51.net/article/49779.htm

通常我们的做法是 

if($('.mydiv').length>0)

 

比较可靠且不会出错的做法是:


if($('.mydiv').length && $('.mydiv').length>0)
  return true;

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-07-19
  • 2022-12-23
  • 2021-07-30
  • 2021-09-16
  • 2021-10-24
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-28
  • 2022-01-05
  • 2021-11-23
相关资源
相似解决方案