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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T21:45:43+00:00 2026-05-26T21:45:43+00:00

I have a data attribute like: <a href=stuff data-open-dialog=location-XXXX>click</a> <a href=stuff data-open-dialog=location-YYYY>click</a> How can

  • 0

I have a data attribute like:

<a href="stuff" data-open-dialog="location-XXXX">click</a>

<a href="stuff" data-open-dialog="location-YYYY">click</a>

How can I bind to data-open-dialog, and obtain value, either XXXX or YYYY?

I know how to bind to a specific value, like:

a[data-open-dialog="location-XXXX"]

but how can I make the value dynamic and then obtain the value on click?

thanks

  • 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-26T21:45:44+00:00Added an answer on May 26, 2026 at 9:45 pm

    What you are doing is not really “bind”-ing. You just want to retrieve its value, or so I think.

    Try something like this:

    $('a[data-open-dialog]').click(function(e) {
        e.preventDefault();
    
        var location = $(this).data('open-dialog');
    
        ...
    });
    

    location will then hold location-XXXX or location-YYYY. It should be a simple matter for you to strip the “location-” part.

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

Sidebar

Related Questions

I have data like this: ID ATTRIBUTE START END 1 A 01-01-2000 15-03-2010 1
For example I have data model like this Entity: Store Entity: Inventory Entity:Product Attribute:
I have data that looks like CUSTOMER, CUSTOMER_ID, PRODUCT ABC INC 1 XYX ABC
I have a ul with data attributes. Like this: <ul class=carousel-creations> <li data-teaflavour=pear> </li>
I have a large ARFF file with data that looks something like this: 555,2011-03-13
Does HTML's data attribute work in IE6? I'm using the attribute like this <img
I have a list like so <ul id=a> <li data-id=i1 data-pk-type=foo bar>sdfsf</li> <li data-id=i2
I have the following jQuery Code: $(#menu span).click(function() { var url = this.getAttribute(data-url); var
I am constructing enum values that have a data structure like the following: enum
I have some data that has various attributes and I want to hierarchically group

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.