The method stateManager.handleClick elem paramater is a DOM element and not a jQuery object. Running .find() on it will throw an error Uncaught TypeError: elem.find is not a function.
var stateManager = {
fly: function () {
var self = this;
$( "#container" )
.unbind()
.on( "click", "div.toggle", function ( e ) {
self.handleClick( e.target );
});
},
handleClick: function ( elem ) {
elem.find( "span" ).toggle( "slow" ); // Should be $( elem ).find()
}
};
The method
stateManager.handleClick
elem paramater is a DOM element and not a jQuery object. Running .find() on it will throw an errorUncaught TypeError: elem.find is not a function.