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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T07:07:41+00:00 2026-06-13T07:07:41+00:00

I do not find any example how to read unobtrusive data using jQuery. For

  • 0

I do not find any example how to read unobtrusive data using jQuery. For example below

<a id="deleteFile" href="" data="123">Delete file</a>

I would like to read data attribute from a element. How to do that?

  • 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-13T07:07:42+00:00Added an answer on June 13, 2026 at 7:07 am

    The best way is to just get the element attribute

    $('#deleteFile').attr('data');
    

    If your using a newish jquery library version (higher than 1.6 i belive) you can also use HTML5 data attributes with jQuery’s data(). Change your anchor link to something like

    <a id="deleteFile" href="" data-fileid="123">Delete file</a>
    

    then you can use

    $('#deleteFile').data('fileid');
    

    However do NOT use them interchangeably, use one method only otherwise you may incur issues later on as jQuerys data() will only READ the data attributes then store them in an internal cache. If you change anything via data(), it will not be changed in the actual tag attribute meaning data() and attr() will return different results thereafter

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

Sidebar

Related Questions

all. Maybe i've not googled enough, but i can't find any example on this
I'm not able to get this persistence file correct... I do not find any
I've looked around, and did not find any information to create numpy.float64 using the
I did not find any suitable questions answered yet, so I'd like to know
I've been searching around but could not find any answers to this. What I'm
I spent about hour and did not find any clue how to highlight my
I have Googled merge+cell+Javascript but did not find any suitable code to implement merge
I tried searching in google but could not find any useful answer, if(verifier.length() >
HEllo , i can not find any way to get horizontal or/and vertical resolution
So I've been looking around for days now and I can not find any

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.