I know as of jQuery 1.7, the .live() method is deprecated. So this is what I came up with:
$(document.body).on('click', '#list', function() {
console.log($(this));
});
Which pretty much does the trick and is equivalent to:
$('#list').live('click', function(){
console.log($(this));
});
They both return the #list jQuery object, which is what I wanted. The problem is however when I pass a jQuery object as a second parameter, instead of string (which happens quite often), eg:
var list = $('#list');
$(document.body).on('click', list, function() {
console.log($(this));
});
The console returns $(body) jQuery object. Which is useless in that point. ;) Any ideas?
EDIT: The problem here is NOT how to access the affected object $('#list') from example 1 and 2, but how to access it in example 3.