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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T03:30:44+00:00 2026-06-06T03:30:44+00:00

Below is my code and currently it searches the whole webpage. I’m trying to

  • 0

Below is my code and currently it searches the whole webpage. I’m trying to figure out how to make it search only within a table. (There is only one table on the page).

Any help would be appreciated.

var TargetLink              = $("a:contains('gg')");
var TargetSink              = $("a:contains('u')");

if (TargetLink  &&  TargetLink.length)
{
window.location.href    = TargetLink[0].href;
} 
else if (TargetSink  &&  TargetSink.length) 
{
window.location.href    = TargetSink[0].href;
}
  • 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-06T03:30:46+00:00Added an answer on June 6, 2026 at 3:30 am
    var TargetLink              = $("table a:contains('gg')");
    var TargetSink              = $("table a:contains('u')");
    

    EDIT:
    You say there is only one table on the page. Do you absolutely know there will only ever be one table? Even if you think the answer is yes, I would try and add an id or class selector so that things won’t break in the future.

    Also, the following code can be simplified:

    if (TargetLink  &&  TargetLink.length)
    

    to:

    if (TargetLink.length)
    


    Re: "could I combine those 2 variables into 1":

    Use a comma in the selector, like so:

    //--- Need more of the HTML structure for a better selector.
    var TargetLink              = $("table")
                                .find ("a:contains('gg'), a:contains('u')")
                                ;
    if (TargetLink.length) {
        window.location.href    = TargetLink[0].href;
    } 
    

    If both kind of links are found, 'gg' will be used (first).

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

Sidebar

Related Questions

I am trying to modify the sample code below. It currently populates a View
I'm trying to learn C++ currently, but I'm having issues with the code below.
I have a python psp page code is shown below. Currently it only prints
Currently my code below works fine but it's a bit of overkill. In my
Currently i'm using below code which works well. $(#topperAtBaseLevel:visible, #lowerAtBaseLevel:visible, #midAtBaseLevel).hide(); any optimised code?
Hello everyone I'm currently having 2 issues with the code below: Upon return of
I've put together a small code-sample below (Currently in C# 3.5 but would also
I currently use the following code to position a div directly below an input
Im trying to generate a color gradient using ColdFusion. My current code below works
Below is the code currently I am using for grouping in listview . I

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.