Solved

Get html5 data tag

Posted on 2013-01-04
1
269 Views
Last Modified: 2013-01-04
Im trying to get data out of a html5 div:-

<div data-transactionID='22' class='clsTransactionRow'></div>
<div data-transactionID='23' class='clsTransactionRow'></div>
<div data-transactionID='24' class='clsTransactionRow'></div>
<div data-transactionID='25' class='clsTransactionRow'></div>

Open in new window


I need to be able to get the 'transactionID', so using jQuery I thought I could just add:-
$(".clsTransactionRow").click(function () { alert(jQuery.data($(this), 'data-transactionID')); });

Open in new window


However, all I get is 'undefined' as my messagebox.

What am I doing wrong?

Thank you
0
Comment
Question by:tonelm54
1 Comment
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 total points
ID: 38745312
replace : transactionID
by : transactionid

and use : $(this).data('transactionid')

test page : http://jsfiddle.net/VBT3w/

more info : http://xenforo.com/community/threads/html-5-data-attributes-and-case-sensitivity.15609/
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to deal with the query string 8 44
jQuery Toggle & Anchor Links 5 55
ASP.NET MVC -Update model when click on <li> element 29 68
toggle content 12 25
DOM Attributes and Properties treatment with jQuery 1.6 by Ivo Stoykov jQuery (http://jquery.com/) 1.6 introduces .prop() (http://api.jquery.com/prop/) and .removeProp() (http://api.jquery.com/removeProp/) methods which allow modifying or removi…
What is a Lightbox? A Lightbox is the effect you see when you click, for example, an image and the screen fades out and up pops the same image but in its full size dimensions. There are lots of Lightbox effects for jQuery. Problem is they are a…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question