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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T18:29:06+00:00 2026-06-10T18:29:06+00:00

Hello people i have problem with jquery toggling script.. <a class=clickMe>Text 1</a> </br> <div

  • 0

Hello people i have problem with jquery toggling script..

<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>


$('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();
});

above script is working fine please check the demo

but now what i need to use <div id in place of <div class without changing the functionality of the script… i tried many ways but still having some issues…i may dont have to use <a class="clickMe"> is there is way 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-10T18:29:08+00:00Added an answer on June 10, 2026 at 6:29 pm

    With unique IDs:

    <a class="clickMe" toggle="first">Text 1</a>
    </br>
     <div id="first" class="text"> - This text will be toggled</div>
    
    <a class="clickMe" toggle="second">Text 2</a>
    </br>
    <div id="second" class="text"> - This text will be toggled 2</div>
    
    
    $('a.clickMe').click(function () {
       id = $(this).attr('toggle');
       $('.text').not('#' + id).hide();
       $('#' + id).show();
    });
    

    See my Demo or my edited Demo or the third Demo.

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

Sidebar

Related Questions

Hello people of stackoverflow. I have a problem. I'm trying to set up my
Hello people i stick on a problem i have a header with no zoom
Hello good Stack Overflow people, I do have a business problem and would like
Hello wonderful people of stackoverflow! I have a problem. I am working on an
I know many people have had this problem and I have searched Google/Stack Overflow,
Hello folkes I have this little problem for which I cannot find a suitable
Hello Good People !! I have a web application (my first of this type)
Hello people I have made a custom title bar for my app. I would
Hello people of StackOverflow! I have used the searrch option, I've found some related
Hello again Stackoverflow people! Assume I have these words: smartphones, smartphone I want to

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.