Advertisement
Guest User

Untitled

a guest
May 4th, 2015
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. <ul>
  2. <li class="foo">foo text</li>
  3. <li class="foo2">foo2 text</li>
  4. <!-- more li here -->
  5. <li class="bar">bar text</li>
  6. <li class="bar2">bar2 text</li>
  7. <!-- more li here -->
  8. <li class="baz">clickme!</li>
  9. </ul>
  10.  
  11. $(".baz").click(function() {
  12. alert("test: " + $(this).siblings(".bar")[0].text());
  13. });
  14.  
  15. $(this).siblings(".bar").eq(0).text()
  16.  
  17. $(this).prev(".bar").text()
  18.  
  19. alert(siblings(".bar").first().text());
  20.  
  21. $(".baz").click(function() {
  22. alert("test: " + $(this).prev(".bar").text());
  23. });
  24.  
  25. $(".baz").click(function() {
  26. alert("test: " + $(this).prev.html());
  27. });
  28.  
  29. $(".baz").click(function() {
  30. alert("test: " + $(this).siblings(".bar").eq(0).text());
  31. });
  32.  
  33. $(".baz").click(function() {
  34. var text = 0;
  35. $(this).siblings(".bar").each(function(){ text = $(this).text(); break; });
  36. alert("test: " + text);
  37. });
  38.  
  39. $("selector").nextAll();
  40. $("selector").prev();
  41.  
  42. $("h2").siblings('table').find('tr');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement