I have some problems with jquery. If I provide my jQuery in a function, it fails.
function foo(){
$(this).hide();
}
<input type='button' value='Button' onclick='foo()'>
I tried to fire the event inside onclick and it worked.
<input type='button' value='Button' onclick='$(this).hide()'>
I think the problem is the 'this' object, but I could not understand why.
source
share