Advertisement
Guest User

Untitled

a guest
Apr 16th, 2014
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. <div class="dropdown-menu-portfolio">
  2. <label>All</label> // This is the text I want to update
  3. <ul class="category-navbar">
  4. <li class="select">
  5. <a>All</a>
  6. </li>
  7. <li>
  8. <a>Item2</a>
  9. </li>
  10. <li>
  11. <a>Item3</a>
  12. </li>
  13. <li>
  14. <a>Item4</a>
  15. </li>
  16. </ul>
  17. </div>
  18.  
  19. $(".category-navbar li a").click(function() {
  20. $(this)
  21. .copy(".select a").text()
  22. .replace(".dropdown-menu-portfolio label").text();
  23. });
  24.  
  25. $(".category-navbar li a").click(function() {
  26. $(this)
  27. .clone(".select a")
  28. .appendTo(".dropdown-menu-portfolio label");
  29. });
  30.  
  31. $(".category-navbar li a").click(function() {
  32. // Modifying the label
  33. $('div.dropdown-menu-portfolio label').text($(this).text());
  34.  
  35. // Removing the class 'select' to the item previously selected
  36. $('li.select').removeClass('select');
  37.  
  38. // Giving the class 'select' to the item currently selected
  39. $(this).parent().addClass('select');
  40. });
  41.  
  42. $(".dropdown-menu-portfolio label").text($(this).text());
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement