#10668 closed enhancement (invalid)
Allow jQuery.data() to update data-attributes
Reported by: | rodneyrehm | Owned by: | |
---|---|---|---|
Priority: | undecided | Milestone: | None |
Component: | unfiled | Version: | 1.7 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
jQuery.data() should be able to (selectively) update data-attributes in order to make something like
$('.selector').data('foobar', 1);
selectable like
$('[data-foobar]').hide();
see modified code and jsFiddle for a possible solution (introducing a new argument 'updateAttr').
Change History (2)
comment:1 Changed 11 years ago by
Resolution: | → invalid |
---|---|
Status: | new → closed |
comment:2 Changed 11 years ago by
I'm terribly sorry to have bothered anyone with this. There's a much simpler (and imho cleaner) solution to this: http://jsfiddle.net/rodneyrehm/XV33m/
Note: See
TracTickets for help on using
tickets.
Nope. By design we don't write to those attributes under any circumstances, and doing so in a consistent way would affect all the data APIs plus incur a big performance penalty. Use
.attr()
.http://www.learningjquery.com/2011/09/using-jquerys-data-apis