Bug Tracker

Opened 10 years ago

Last modified 10 years ago

#12397 closed feature

Allow passing a function to .data() as an each style setter. — at Initial Version

Reported by: gnarf Owned by:
Priority: low Milestone: None
Component: data Version: 1.8.0
Keywords: 1.9-discuss Cc:
Blocked by: Blocking:

Description

Example Usage:

jQuery( ".button" ).data(function( index, data ) {
    if ( data.href ) {
         // <div class="button" data-href="/">
    }
    if ( data.confirm ) {
         // etc
    }
    jQuery( this ).button();
});

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...

Change History (0)

Note: See TracTickets for help on using tickets.