SHARE
TWEET

Untitled

a guest Feb 22nd, 2019 53 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <div id='testDiv'>ddd
  2.    <div class='test'> 111<div> another div </div></div>
  3.    <div class='test'> 222</div>
  4.    <div class='test'> 333</div>
  5.    more...
  6. </div>
  7.    
  8. if($('#testDiv.test').length>5){
  9.    alert('haha');
  10. }
  11.    
  12. $('#testDiv .test').length
  13.    
  14. if( $('#testDiv .test').length > 5 ){
  15.    alert('haha');
  16. }
  17.    
  18. $('#testDiv .test').length
  19.    
  20. $('#testDiv.test') //- element with ID testDiv and class test  
  21. //<div id="testDiv" class="test">...</div>
  22.    
  23. <div id="testDiv" class="test">
  24.    
  25. $('#testDiv .test")
  26.            ^--- note the space
  27.    
  28. $('#testDiv').children('.test').length;
  29.    
  30. $("#testdiv").children(".test")
  31.    
  32. $("#testdiv .test")
  33.    
  34. $("#testdiv.test")
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top