tonelm54
asked on
Pull data element
Trying to do a simple task of pulling the value out of the data element, which I thought would be easy, but obviously not. To simplify my issue, Ive got the following HTML code:-
And then to simply pull out the value:-
However I keep getting 'undefined', and I cannot figure out why, does anyone have any ideas?
Ive put it onto jsFiddle in the hope someone can point out the error of my ways.
Thank you in advance
<div id="divMenu">
<div data-folderID="4" class="menuTopItem">Operational</div>
<div data-folderID="5" class="menuTopItem">Administrative & Accounting</div>
<div data-folderID="6" class="menuTopItem">Time Sheets</div>
<div data-folderID="7" class="menuTopItem">Interface</div>
<div data-folderID="8" class="menuTopItem">Setup</div>
</div>
And then to simply pull out the value:-
$(document).ready(function () {
$('.menuTopItem').click(function (e) {
alert($(this).data("folderID"));
});
});
However I keep getting 'undefined', and I cannot figure out why, does anyone have any ideas?
Ive put it onto jsFiddle in the hope someone can point out the error of my ways.
Thank you in advance
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.