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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T18:09:32+00:00 2026-06-06T18:09:32+00:00

Possible Duplicate: jquery data selector I have several elements with class ‘connection_name’. Each one

  • 0

Possible Duplicate:
jquery data selector

I have several elements with class ‘connection_name’. Each one of these elements has a unique id bound to it using the data() JQuery function. I’m trying to query to find the element with a given id, but I can’t seem to get it to work.

For the sake of this test, I created a page with only 1 element, and set the id of the element.

I can verify that the id is being set, as when I query the element in the console, it shows the id returned:

$('.connection_name').data()
  Object
  id: "4fea76bd99ea080d19000002"
  __proto__: Object

I’ve read on other questsions/posts that the element should be selected by $(‘selector[data-attribute=value]’), but that doesn’t seem to work:

$('.connection_name[data-id="4fea76bd99ea080d19000002"]')
[]

Worse than that, even when I try to select it without any value (just by the attribute), I still return nothing:

$('.connection_name[data-id]')
[]

I’m not sure what the issue is, or how to go about doing this.

  • 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-06T18:09:34+00:00Added an answer on June 6, 2026 at 6:09 pm

    Here’s one way to do it:

    var theItem = $('.connection_name').filter(function() {
        return($(this).data("id") === "4fea76bd99ea080d19000002");
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: jQuery multiple class selector I have an input field '#q' where a
Possible Duplicate: jQuery: Return data after ajax call success I have the following function
Possible Duplicate: jQuery delay between animations I have created two functions: One that animates
Possible Duplicate: Getting JavaScript object key list How to iterate json data in jquery
Possible Duplicate: Can someone Explain this jQuery code? I have posted this before, but
Possible Duplicate: What does jQuery.fn mean? I have some script on a page trying
Possible Duplicate: jQuery: Return data after ajax call success I wrote a script which
Possible Duplicate: How does jQuery .data() work? In jQuery, .data reads the values of
Possible Duplicate: jQuery and AJAX response header If the server is returned data in
Possible Duplicate: JQuery datepicker- 2 inputs/textboxes and restricting range Hi i have two pickers

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.