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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T03:15:39+00:00 2026-06-14T03:15:39+00:00

I have buttons with a class named nav, when a button is clicked the

  • 0

I have buttons with a class named nav, when a button is clicked the ID is read and the variable “pre” is set to the ID. Once the variable is set I’m removing part of the id, “-link”. This part is working fine but could be where my problem is being created. Once “-link” has been removed I’m trying to use the remainder of pre to target the id of a div on the page and animate it. So I use another variable to hack together…

curr = '$("#'+pre+'")';

This “appears” to create what I need but when I target curr in my animation nothing happens. Probably b/c I have created a string and this is where my knowledge begins to fade.

Below is the complete function. I plan to use this with multiple buttons that have corresponding div’s so it would be nice to use a single function for the whole class.

var pre = null;
var curr = null;     
$('.nav').click(function(){
               pre = $(this).attr("id");
               pre = pre.substring(0, pre.indexOf("-link"));
               curr = '$("#'+pre+'")';
               alert(curr);
                curr.animate({opacity:1}, {
                   duration:250,
                   queue:true,
                   complete:function(){
                     //  alert("calling moveOld");
                       moveOld();
                       }
               });

           });
  • 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-14T03:15:40+00:00Added an answer on June 14, 2026 at 3:15 am

    You don’t need the quotes around it, that’s the problem.

    $('#'+ pre)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have few buttons of which each button is assigned a class with a
I have main activity which contains few radio buttons. Their is one button named
I have 4 buttons that when click starts a new activity class. This works
I have created a button CSS class that uses background images with different positions
I have created my own button class called custom_btn. I created it on the
I have some class SimpleButton . It is a Child of Button class. Button
I have a button that can have a focus css class associated with it
I have a Button and the button content is binded to a custom class
I have crated a class which extends the ListFragment . I have one button
I have a Main class and a HelloWorld class. I have created a button

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.