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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T00:51:23+00:00 2026-06-06T00:51:23+00:00

In jQuery we usually use, for example: var content = $(‘tr#someid td’).find(‘div’).html(); var content

  • 0

In jQuery we usually use, for example:

var content = $('tr#someid td').find('div').html();
var content = $('tr#someid div').has('p').text();
var content = $('tr#someid td:eq(1) div').html();

Is it possible to make the right part of dollar sign $ dynamic?

// Pattern Array
var pattern = [
    "('tr#someid td').find('div').html()",
    "('tr#someid div').has('p').text()",
    "('tr#someid td:eq(1) div').html()"
];

var contents = "";
for (i=0; i<pattern.length; i++) {
    /*
     * I WANT TO GRAB THE ELEMENTS HERE!
     * SOMETHING LIKE:
     */
     var dynamic_var = pattern[i];
     contents += $dynamic_var;
}

Is it possible?
So the problem is:

  • Can we make the Variable Variable in jQuery Selector?
  • Like: $_______________; ?
  • The blank _________ will be a dynamic pattern variable
  • 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-06T00:51:26+00:00Added an answer on June 6, 2026 at 12:51 am

    May be you could use eval, please check the demo

    <div id="div">This is a div</div>
    <input type="button" value="show" id="show" />​
    
    var arr = ['("#div")'];
    $('#show').click(function(){
        eval('$'+arr[0]);
    });
    

    ​Not really sure if this will serve your purpose but hope this help.

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

Sidebar

Related Questions

I usually use JSON with jQuery to just return a string with html. However,
Almost all of the examples in the jQuery tutorials that I've read, usually use
I use jQuery icons in my asp.net mvc project. Usually I use gray icons
Drupal has a very well-architected, jQuery -based autocomplete.js . Usually, you don't have to
For example, in the following HTML ... <form name=outerform> <input type=text name=outer1/> <input type=text
is the jQuery function change() working in IE ? I usually use it to
How to use JQuery to call a servlet which I usually call like this
Some jQuery use cases call for letting the user know (usually through some animation)
In javascript I can easily use JQuery to get css, for example: $(#id).css(); I
Ok guys im a bit stuck here. I usually use jquery to do this

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.