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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T16:57:13+00:00 2026-05-16T16:57:13+00:00

If I have this HTML: <a id=test referenceId=test23 href=”>Test</a> and I want to get

  • 0

If I have this HTML:

<a id="test" referenceId="test23" href=''>Test</a>

and I want to get the selector based on the referenceId attribute (not the id)

I know I can do this

$('#test'). . ..

but I want to understand if I can do a similar thing but using the referenceId attribute to get the selector.

  • 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-16T16:57:14+00:00Added an answer on May 16, 2026 at 4:57 pm

    Searching from attribute values should not be done directly on the root document, and especially not using a very generic selector as it is quite slow, and should be limited to a specific parent, a specific tag name, or on elements with a shared CSS class. For example, in your case, if referenceId is an attribute only specified to anchor elements, you query :

    $("a[referenceId='someValue']")...
    

    If you have this attribute on different tag names, you can narrow the search specifying a common parent, or using multiple selectors, etc. in the same query. For example :

    $("div#parent [referenceId='someValue']")... // use div#parent as base element
    $("a[referenceId='someValue'], span[referenceId='someValue']")... // search A and SPAN tags only
    $(".ref[referenceId='someValue']")... // search any element with "ref" CSS class
    // etc.
    

    Note that it is recommended to enclose the attribute value in quotes. You can read more about selectors from the jQuery API docs.

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

Sidebar

Related Questions

I have code like this: string uriString = @C:\Temp\test.html; Uri uri = new Uri(uriString);
Suppose I have the following html: This a test of <code>some code</code>. <div class='highlight'>
I have these (sample) lines in a HTML-file: test.ABC.test test.ABCD.test test.ABCE.test And this Ant
<p title=The test paragraph>This is a sample of some <b>HTML you might<br>have</b> in your
I have this: function test() { this.method = function () { $(html).mousemove(function(event) { console.log('~>
I have this HTML code for radios: <input type='radio' name='a_27' value='Yes' id='a_27_0' /> <input
i have this html: <span class=price> $61.00 <span class=detailFreeShipping>With Free Shipping</span> </span> How to
I have this HTML dropdown: <form> <input type=text id=realtxt onkeyup=searchSel()> <select id=select name=basic-combo size=1>
I have this html: <div class=foo parent> <div class=child></div> </div> with some css: .foo{
I have this HTML structure (excerpt): <td> <select id=test1 class=pub_chooser> <option value=99>All Publications</option> <option

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.