[jQuery] using data() to store additional info in the html markup
Hi!
i'm trying to store some additional information only useful for my
javascript. I thought i could use a data html attribute to do that but
it does not seem to work: console.log() returns "undefined"
here is the relevant extract of my code, in case i did something
wrong:
<tr>
<td><div class="event 2009-08-2816C213" style="float:left;width:
65px" data="{eventLength: 6}">
<div class="event-title"><span
class="classe">C213</span> - <span class="Prof">2TID1</span></div>
</td>
</tr>
javascript: (document ready)
$('div.event').each(function(){
console.log('eventlength= '+$(this).data('eventLength'));
});
that returns "undefined".