Opened 11 years ago
Last modified 11 years ago
#12397 closed feature
Allow passing a function to .data() as an each style setter. — at Version 1
Reported by: | gnarf | Owned by: | |
---|---|---|---|
Priority: | low | Milestone: | None |
Component: | data | Version: | 1.8.0 |
Keywords: | 1.9-discuss | Cc: | |
Blocked by: | Blocking: |
Description (last modified by )
Example Usage:
jQuery( ".button" ).data(function( index, data ) { if ( data.href ) { // <div class="button" data-href="/"> } if ( data.confirm ) { // etc } jQuery( this ).button(); // return value discarded, data must remain the same object for other uses });
The code would be a pretty simple each, and it would let you quickly inspect/alter the data object on an entire jQuery collection.
The same could NOT be done for the elems.data( "key", fn )
signature, because you want to set that key to a function...
Note: See
TracTickets for help on using
tickets.