I’m using this:
$('.sizeChart').on('vclick', '.entry .ui-btn', function(e){
console.log( e )
console.log( e.currentTarget )
console.log( $( e.currentTarget )
console.log( $( e.currentTarget ).find('input.qtyInput') )
var qty = $( e.currentTarget ).find('input.qtyInput');
// do something
});
Which works, but $( e.currentTarget ).find(...) seems awkward to me.
I can’t bind directly to the input because this binding will go dead on iOS3+4 after a couple of clicks. Binding to the closest ui-btn works throughout.
Question:
Is there a better/easier/faster way to do the binding than what I’m using ?
You can just use
thisinstead ofe.currentTarget:Proof that
event.currentTargetandthisare the same.Also the documentation says:
That’s about it. It is pretty common to pass a DOM element directly to jQuery and use DOM traversal methods on it.