Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8838765
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T10:05:21+00:00 2026-06-14T10:05:21+00:00

<ul class=filter> <li> <span class=filtertext><span>Filter</span></span> <ul class=dropdown> <li class=active><a href=javascript:void(0)>All</a</li> <li><a href=#>Administrative Associates</a></li> <li><a

  • 0
<ul class="filter">
<li>
<span class="filtertext"><span>Filter</span></span>
<ul class="dropdown">
<li class="active"><a href="javascript:void(0)">All</a</li>

<li><a href="#">Administrative Associates</a></li>
<li><a href="#">Associate Principals</a></li>
<li><a href="#">Associates</a></li>
<li><a href="#">Chief Financial Officer</a></li>
<li><a href="#">Directors</a></li>
<li><a href="#">Principals</a></li>
<li><a href="#">Senior Associates</a></li>
<li><a href="#">Staff</a></li>
</ul></li>
</ul>

I have a filter set up with Quicksand and the above list is displaying a dropdown on my site. What I am trying to do is replace the text “Filter” that is in the tag with text from whatever category is selected.

I have this working, however, it only does it the first time. I have a feeling I need to implement something like .each() but can’t seem to figure out where exactly I should put it. Following is my jQuery code:

$('ul.dropdown li a').click(function (){
$('span.filtertext span').replaceWith( $(this).html() );
});

Please let me know if you need more information. Thank you!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T10:05:22+00:00Added an answer on June 14, 2026 at 10:05 am

    The reason it only work the first time is because you’re using replaceWith, which actually removes the element; the next time your function runs, $('span.filtertext span') can’t find anything.

    Use this instead (adds caching too):

    var $filtertext = $('span.filtertext span');
    $('ul.dropdown li a').click(function () {
        $filtertext.text( $(this).text() );
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

works: <form class=filter onsubmit=alert('submit');> <span class=a></span> <span class=b> <input type=text name=b /> </span> </form>
I wrote the following : <ul> <li> <span class=filter> <label>Name: </label><input type=text/> </span> </li>
I have the following thats within a loop... echo <span class='srch-val'>.apply_filters( $value\n, $value).</span>; I
Silverlight filter/class for cloud generation? Some HLSL or just C# class for generating clouds?
I have a filter: class MyFilters { def filters = { before = {
My filter mapping in web.xml is as follows: <filter> <filter-name>LoginCheckFilter</filter-name> <filter-class>com.tutorial.filter.LoginCheckFilter</filter-class> </filter> <filter-mapping> <filter-name>LoginCheckFilter</filter-name>
Sorry if this is a dumb question but im creating a filter class that
Is there a way construct a predicate to filter by class type? I currently
I have this CSS. the property FILTER In class .crumb make my background and
Here is my html: <a href=#>Read more</a> <div class=moreDetails> <p class=additionalText>Some text help here,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.