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

  • SEARCH
  • Home
  • 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 6105221
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:57:13+00:00 2026-05-23T13:57:13+00:00

I have a very strange problem. I am using jQuery to intercept a particular

  • 0

I have a very strange problem. I am using jQuery to intercept a particular tag click.

I have:

<a class="question">lorem ipsum</a>
<a class="question_selected">lorem ipsum</a>
<a class="question">lorem ipsum</a>
<a class="question">lorem ipsum</a>

And my jQuery is:

$("a.question").click(function(){.....});

It should intercept the <a> click where class=”question” but it is also intercepting whenever I click <a class="question_selected">.

What can be the problem?

EDIT:
I am actually changing the classes on click. The tag that I click should become “question_selected” and all other should be “question”. Here is the jQuery: $('a.question_selected').removeClass('question_selected').addClass('question'); $(this).addClass('question_selected').removeClass('question');

  • 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-05-23T13:57:14+00:00Added an answer on May 23, 2026 at 1:57 pm

    Remove the underscore from the class name. Perhaps there’s a bug in jQuery regarding that.

    Otherwise, this doesn’t directly answer your question, but some suggestions:

    First of all, instead of swapping the class, I’d just use two classes:

    <a class="question">lorem ipsum</a>
    <a class="question selected">lorem ipsum</a>
    

    Then, in your jQuery, I’d cache your questions:

    $questions = $('a.question');
    

    And then your jquery can be:

    $questions.click(function(){
        $questions.filter('.selected').removeClass('selected');
        $(this).addClass('selected');
    })
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have encountered a very strange problem in using jQuery load() . I used
We have encountered a very strange class not found problem in our web app
I have a very strange problem. Using Gmap3, I place the pin on the
I'm encountering a very strange problem using g++ 4.1.2. I have a very basic
I have a very strange problem. (fyi - I'm using forms authentication and manually
I'm experiencing a very strange problem with Rails and ajax using jQuery (although I
I have a very strange problem when I using ajax in symfony 1.4. I've
EDIT: I have managed to solve the problem by using: +lorem ipsum +type:photo +lorem
I have very strange problem. I'm using IIS 7.0 Integrated mode for my application.
I have a very strange problem in my code. I'm using Ogre and I'm

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.