I’m doing this:
return this.each(function(){
$.this.load('searchInterface.html',function(){
console.log('load');
//a lot of code
});
$('#more_button').bind('click',more());
function more(){
console.log('more');
}
});
And my console is showing:
more
load
That means that somewhere inside .load(), something is clicking on my button.
How can I avoid this behavior?
Thanks!
Declare more above the line that reads $(‘#more_button’).bind(‘click’,more()); and remove the parentheses.
You should be referencing the function, not invoking it.