Advertisement
Guest User

Untitled

a guest
Apr 17th, 2014
34
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. <div id='idthatiknow'>
  2. <div>
  3. <span>good1</span>
  4. </div>
  5. <div>
  6. <span>good2</span>
  7. </div>
  8. <p>
  9. <span>bad</span>
  10. <div>
  11. <span>bad</span>
  12. </div>
  13. </p>
  14. <div>
  15.  
  16. $('#idthatiknow span').filter(function() {
  17. return $(this).closest('p').length === 0;
  18. });
  19.  
  20. #idthatiknow > div span { /* your styles here */}
  21. /* all spans with a direct child of div from #idthatiknow */
  22.  
  23.  
  24. #idthatiknow span:not(#idthatiknow > div span) { /* your styles here */}
  25. /* all spans except the ones with a direct child of div from #idthatiknow */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement