Home › Forums › CSS › HTML5 data attributes and Jquery problem › Re: HTML5 data attributes and Jquery problem
March 13, 2013 at 2:38 pm
#128084
Participant
$(‘[data-day=’+d.getDate()+’] > h2′).addClass(‘highlight’);
The [`.data()`](http://api.jquery.com/data/#data2) function only returns the data attribute for the first element of a set, so your variables are pretty much useless. It’s not that inefficient to store values though. It’s a trade-off of memory vs cpu, most of the time memory is abundant.