Wednesday, 11 September 2013

how to call a variable outside of function

how to call a variable outside of function

jquery
$(selector).on('click',function(){
var $myvar = 'hi';
});
alert($myvar); // this won't alert hi as this is out of click function
How can I call that $myvar outside the function?

No comments:

Post a Comment