Created
December 2, 2011 10:22
-
-
Save vincicat/1422705 to your computer and use it in GitHub Desktop.
jQuery 1.7 event data access
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Source: http://jsbin.com/erirek/ | |
$( function() { | |
var $hello = $( "#hello" ).click( function() { | |
alert( "hello world" ); | |
}); | |
// does NOT return object the inclues the events property | |
// pre-1.7 this used to include the events property | |
console.log( $hello.data() ); | |
// does return events object | |
// code was added to 1.7+ to get at the events if you explicitly ask for it | |
console.log( $hello.data( "events" ) ); | |
// does return object that includes the events property | |
// internal method, not documented | |
console.log( $._data( $hello[ 0 ] ) ); | |
// does return evetns object | |
// internal method, not documented | |
console.log( $._data( $hello[ 0 ], "events" ) ); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment