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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T21:45:04+00:00 2026-06-16T21:45:04+00:00

As I will have multiple places where this is, I would like to get

  • 0

As I will have multiple places where this is, I would like to get it to work with a unique data.

Like instead of <a class="snippet_show_answers" href="#">Se svar</a> then maybe something like <a DATA="1" class="snippet_show_answers" href="#">Se svar</a>, which then should run as a part of my script, so that it only handle for the clicked DATA, and not for all of the boxes.

My HTML is this (With multiple of those):

<p class="snippet_answers">Svar: 3 - <span class="green"><a class="snippet_show_answers" href="#">Se svar<img src="images/answerarrow.png" alt="answerarrow" height="14" width="13"></a><a class="snippet_hide_answers" href="#" style="display: none;">Skjul svar<img src="images/answerarrow.png" alt="answerarrow" height="14" width="13"></a></span><hr />
    <div class="answers" style="display: none;">
        <p>blablabla</p>
    </div>
</p>

My JS is this:

$('.snippet_show_answers').live("click", function() {
    $('.answers').slideDown("slow");
    $('.snippet_show_answers').fadeOut("slow");
    $('.snippet_hide_answers').fadeIn("slow");
    return false;
});

$('.snippet_hide_answers').live("click", function() {
    $('.answers').slideUp("slow");
    $('.snippet_hide_answers').fadeOut("slow");
    $('.snippet_show_answers').fadeIn("slow");
    return false;
});

Hope someone understand me, cause I have seen this method before, but I dont know the name of it, or anything.

Thanks in advanced.

  • 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-16T21:45:05+00:00Added an answer on June 16, 2026 at 9:45 pm

    Get a reference to the clicked item’s parent element and then find its descendants with the appropriate class:

    $('.snippet_show_answers').live("click", function() {
        var item = $(this).closest(".snippet_answers");
        item.find('.answers').slideDown("slow");
        item.find('.snippet_show_answers').fadeOut("slow");
        item.find('.snippet_hide_answers').fadeIn("slow");
        return false;
    });
    
    $('.snippet_hide_answers').live("click", function() {
        var item = $(this).closest(".snippet_answers");
        item.find('.answers').slideUp("slow");
        item.find('.snippet_hide_answers').fadeOut("slow");
        item.find('.snippet_show_answers').fadeIn("slow");
        return false;
    });
    

    Also, if you are using the latest version of jQuery, make sure to change .live() to .on(). .live() was recently deprecated.

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

Sidebar

Related Questions

My application uses a MapView which will display multiple places. I have the latitude
I have multiple classes that will store similar data for different uses and I
We have some code that looks like this: class Serializer { public: template<class Type>
I will have multiple tables used by different projects on the same mySql server.
i am doing a project that will have multiple channels for clients chatting. Each
I need to create a WP site which will have multiple subjects. Each subject
For a project I'm working on I will have multiple servers and lots of
_Hey, I have a question. I want to write application which will have multiple
I am making an application which will have an interface similar to Photoshop: multiple
I want to display a UITableView with Multiple Columns. The first column will have

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.