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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T15:39:09+00:00 2026-06-09T15:39:09+00:00

Here is the code i have: <a class=clickMe>Text 1</a> <br /> <div class=sri> –

  • 0

Here is the code i have:

<a class="clickMe">Text 1</a>
<br />
<div class="sri"> - This text will be toggled</div>

<a class="clickMe">Text 2</a>
<br />
<div class="sri"> - This text will be toggled 2</div>

and the Jquery

$(function () {
    $('a.clickMe').click(function () {
        // find first of following DIV siblings
        // with class "textBox" and toggle it
        $(this).nextAll('div.sri:first').toggle();
    });
});

now it’s working fine by displaying ‘This text will be toggled’ and by hiding ‘This text will be toggled 2’ when Text1 is clicked, but i want it work in the oppsite way, that is,
it should hide ‘This text will be toggled’ and display ‘This text will be toggled 2’ when Text1 is clicked.
Please help me to fix this.

  • 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-09T15:39:10+00:00Added an answer on June 9, 2026 at 3:39 pm

    why need extra classes this will solve your question

        $('a.clickMe').click(function () {
            // find first of following DIV siblings
            // with class "textBox" and toggle it
    $(this).nextAll('div.sri:first').show();        
    $('div.sri:visible').not($(this).nextAll('div.sri:first')).toggle();
    
        });​
    

    live demo

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

Sidebar

Related Questions

I have this class called SiteAsyncDownload.cs Here's the code: public class SiteAsyncDownloader { WebClient
I have the following code: HTML : <div id='example'> <a href='#' data-name='foo' class='example-link'>Click Me</a>
I have this code: <ul> <li class=foo>foo text</li> <li class=foo2>foo2 text</li> <!-- more li
Somewhere in my code I have: class aclass { ... function amethod() { $this->dom
Here is the code I have written for Rectangle class. class Rectangle (l: Double,
I have a class with two constructors (C#). Here is the code snippet: public
here is what my code looks like i have two forms: class Form_1 extends
What is the issue with this code? Here we have two files: classA.h and
UPDATED CODE: Now, I have this code: <h2>Testing</h2> <input type=checkbox name=fruit1 id=id1 class=box>Banana<br /><br
Here's a snippet of my code: <div class="myclass" id="demo" style="display:none;">Hello.</div> <a href="#" onclick="$('.myclass').fade({ duration:

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.