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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T17:53:08+00:00 2026-05-17T17:53:08+00:00

My plan is to have lots of boxes (an undefined amount). When show box

  • 0

My plan is to have lots of boxes (an undefined amount). When show box is clicked under a box, it shows that particular box.

I have some unique divs in my html. The div is made unique by:

<div id="box-<%=box.id%>"></div>

In my application.js, I have

$('.show-box > a').click(function(){
$('#box').show();
});

I obviously need to have the box-id in the $('#box').show(); part but I’m unsure how to do that…

EDIT: adding more information

<div class="show-box">
  <a href="javascript:void(0)">Show</a>
</div>

<div class="box" id="box-<%= box.id  %>"></div>

The class is for styling.

Just to add, I know that the javascript link should link to an actual link. I’ll fix that later.

  • 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-17T17:53:08+00:00Added an answer on May 17, 2026 at 5:53 pm

    You would use this inside the handler to refer to the specific .show-box > a that was clicked.

    So it depends on what the relationship is between that and the box element you want to display.

    When you say under, if that means that it is a sibling to the .show-box element, you can use .parent() to traverse up from the <a>, then use .prev() to traverse back to the box.

    $('.show-box > a').click(function() {
          // "this" refers to the <a> that was clicked.
        $(this).parent().prev().show();
    });
    

    Ultimately, the correct solution depends on your actual HTML markup. If you provide that in your question, it would be helpful.

    You could select by ID if you want, but it is often not necessary.

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

Sidebar

Related Questions

I'm going to be doing some webscraping and my plan is to have something
I have a JMeter test plan with following http request samplers. Login Call some
We have a daily maintenance plan in SQL Server 2005 that performs a full
I have an abstract user control(baseModule) that has a property that I plan on
I have several constants that I use, and my plan was to put them
I would like to be able to run some kind of a show plan
I have a collection class that holds lots of different types of data in
I've written a service and I plan to have multiple applications communicate with it
I have been trying to implement an upgrade plan for my Android app which
I have the following query: select p from Plan as p where p.location =

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.