the markup being used is the way metadata plugin stores data. If you
already have this data marked up like this the metadata plugin is easy
to use to extract it James wrote: data() does not look for an actual "data" attribute string value on the DOM.You have to set it with data(), like: $("#myElement").data('name', 'foo-bar'); and get it with: $("#myElement").data('name'); The second argument (value) is not limited to a string. You can use objects, etc. http://docs.jquery.com/Core/data Additionally, "2009-08-2816C213" is not a valid class name. Class names cannot begin with a number. On Aug 18, 4:25 am, pixeline <aplennev...@gmail.com> wrote: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=""> <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". |
- [jQuery] using data() to store additional info in the html markup pixeline
- [jQuery] Re: using data() to store additional info in the ht... James
- [jQuery] Re: using data() to store additional info in th... Charlie