$ is not defined

I am new in Framework7 and Javascript.

I having hard time fixing this error in my app.js. The error is in line 284 where app.js:262 Uncaught ReferenceError: $ is not defined
at HTMLDivElement. (app.js:262).

I just want to display (using alert) the information I collected from the getinfobyaccountno.php but my plan is to display them in html of course.

You can see that I have hardcoded the accountNumber variable. Actually it is one of my another concern because I have them as a global variable.

Please see my code below.

var self = this;
var app = self.$app;
var $ = self.$;
Or follow framework7 git repo

Are you using JQuery in addition to Framework7?

Framework7 uses ‘$$’ as the selector for Dom7, because JQuery uses ‘$’.

Either add JQuery to your project, or change references of ‘$’ to ‘$$’.

carefull with newcomers

framework7 doesn’t really use “$$” as selector for dom-manipulation
actually it is just “Dom7”

you can do:
var $$ = Dom7; $$('selector');
var $$$ = Dom7; $$$('selector');
var dummy = Dom7; dummy('selector');
or simply

I’m just going by best practices from the docs:

we recommend to assign it to some local variable with more handy name, like $$ , but not to “$” to prevent confilicts with other libraries like jQuery or Zepto

Thanks everyone. @kerrydp answer by adding jquery fix my concern.
Another of my concern is how to prepare, declare and access global variable, will prepare another question for that.

Basically $ is an alias of jQuery() so when you try to call/access it before declaring the function, it will endup throwing this $ is not defined error . This usually indicates that jQuery is not loaded and JavaScript does not recognize the $. Even with $(document).ready , $ is still going to be undefined because jquery hasn’t loaded yet.

To solve this error:

Load the jQuery library at the beginning of all your javascript files/scripts which uses $ or jQuery, so that $ can be identified in scripts .