Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <div class="dropdown-menu-portfolio">
- <label>All</label> // This is the text I want to update
- <ul class="category-navbar">
- <li class="select">
- <a>All</a>
- </li>
- <li>
- <a>Item2</a>
- </li>
- <li>
- <a>Item3</a>
- </li>
- <li>
- <a>Item4</a>
- </li>
- </ul>
- </div>
- $(".category-navbar li a").click(function() {
- $(this)
- .copy(".select a").text()
- .replace(".dropdown-menu-portfolio label").text();
- });
- $(".category-navbar li a").click(function() {
- $(this)
- .clone(".select a")
- .appendTo(".dropdown-menu-portfolio label");
- });
- $(".category-navbar li a").click(function() {
- // Modifying the label
- $('div.dropdown-menu-portfolio label').text($(this).text());
- // Removing the class 'select' to the item previously selected
- $('li.select').removeClass('select');
- // Giving the class 'select' to the item currently selected
- $(this).parent().addClass('select');
- });
- $(".dropdown-menu-portfolio label").text($(this).text());
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement