Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery - calling function variable from another function variable

Why doesn't this work:

  var foo = function() {
     ...
  };

  var boo = function() {
     ... 
     el.foo();
   }

?

I get a foo is undefined error. But I just defined it above...

like image 385
Alex Avatar asked Dec 09 '22 11:12

Alex


1 Answers

You just need to call foo(), not el.foo(). (Unless I'm missing something about how you're using this.)

like image 99
anon Avatar answered Mar 15 '23 23:03

anon