Solved

Get html5 data tag

Posted on 2013-01-04
1
265 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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Introduction HyperText Transfer Protocol (http://www.ietf.org/rfc/rfc2616.txt) or "HTTP" is the underpinning of internet communication.  As a teacher of web development I have heard many questions, mostly from my younger students who have come to t…
Requirements JQuery 1.6+ HTML CSS Introduction This article was inspired by an EE question (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28372511.html) on how to make a page show some balloons animate up a page…
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…

757 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now