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 8268109
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T05:45:42+00:00 2026-06-08T05:45:42+00:00

On a click event of Button 1 how can I remove the class ‘selected’

  • 0

On a click event of Button 1 how can I remove the class ‘selected’ from only this section. The classes of Button 2 should not be removed and the same goes for Button 2, if I click button 2, the classes of Button 1 should not be removed if the class selected exists. I know $('.small-button-1, .small-button-2').removeClass('selected'); removes everything.

<div class="block">
    <div id="abcd" class="lg_button">Button 1</div>
    <div>
        <div class="small-button-1 selected">1</div>
        <div class="small-button-2 selected">2</div>
    </div>
</div> 

<div class="block">
    <div id="dcba" class="lg_button">Button 2</div>
    <div>
        <div class="small-button-1 selected">1</div>
        <div class="small-button-2 selected">2</div>
    </div>
</div> 
  • 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-08T05:45:44+00:00Added an answer on June 8, 2026 at 5:45 am

    I have made it like this but had to rename some html tags to get it working here is my example
    http://jsfiddle.net/fKwGR/

    The jquery part:

    $(document).ready(function() {
    $('div.lg_button1').click(function(){
            $('div.small-button-1.selected').attr('class','small-button-1');
            $('div.small-button-2.selected').attr('class','small-button-2');
            $('div.small-button-3').attr('class','small-button-3 selected');
            $('div.small-button-4').attr('class','small-button-4 selected');
            });
    $('div.lg_button2').click(function(){
            $('div.small-button-1').attr('class','small-button-1 selected');
            $('div.small-button-2').attr('class','small-button-2 selected');
            $('div.small-button-3.selected').attr('class','small-button-3');
            $('div.small-button-4.selected').attr('class','small-button-4');
            });
    });​
    

    HTML part:

    <div class="block">
      <div id="abcd" class="lg_button1">Button 1</div>
      <div id='button1'>
          <div class="small-button-1 selected">1</div>
          <div class="small-button-2 selected">2</div>
      </div>
    

    <div class="block">
      <div id="dcba" class="lg_button2">Button 2</div>
      <div id='button2'>
          <div class="small-button-3 selected">1</div>
          <div class="small-button-4 selected">2</div>
      </div>
    

    ​

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How I can handle the Mouse Right Button Double Click event for a Shape
In button click event I am writing this code.(code behind).I know button click event
I have a button click event that takes information from controls and enters it
I have a button click event handler with a switch case in it that
Is it possible to add button click event by clicking design of axml? if
In a web page button click event we need to export 2,00,000 to 5,00,000
Here is the code for the button click event; Protected Sub CompetenciesButton_Click(ByVal sender As
How to call multiple functions on button click event? Here is my button, <asp:LinkButton
Any clues why the button click event doesn't insert script succesfully? Here is the
I am unable to use click() event on a button which is loaded through

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.