Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

Uncaught ReferenceError: $ is not defined at app.js:36

Please see snapshot for your reference: https://w.trhou.se/roe7yu73a1

thank you in advance for any hints suggestions and comments i would like to thank you in advance.

2 Answers

Martin Balon
Martin Balon
43,651 Points

Hi Karl,

it seems that you are using jQuery as your JavaScript library. The error tells you that $ symbol is not defined. If you look at you index.html you are not importing jQuery and therefore $ is not defined and your code throws an error. Include jQuery in your index.html just above app.js and it should be ok. See the link below for jQuery CDN. I hope this helps.

https://code.jquery.com/

Martin Balon you are right sir, i did not realize that until now i though that was just regular code until you said "$",

how do i do that like this?

  <button type="submit">Register</button>      
</form>

</div> <script src="app.js"></script> <script src="https://code.jquery.com/jquery-3.6.0.js" integrity="sha256-H+K7U5CnXl1h5ywQfKtSj8PCmoN9aaq30gDh27Xc0jk=" crossorigin="anonymous"></script> </body> </html>

Martin Balon
Martin Balon
43,651 Points

Just place it above <script src="app.js"></script>. So first jQuery is loaded and therefore $ is defined in your app.js script. Always place any library above your own script. It's the same like CSS -> you put first normalize or css reset first, then fonts etc. and then your own CSS file. Same goes for JavaScript.