Jquery not being recognized



Hey there. I recently tried creating my first project on Cloud9 that involved the use of jQuery (I’m not new to the library just using it on your platform). I have it in my package.json and linked in like would normally be proper but whenever I use $ it gives me an error like it’s an undeclared variable. What could the reason be for this because I’ve never had this problem on codepen or on my personal dev applications.


Can you show how you imported jQuery and post your HTML file here? Make sure to check the order your scripts load in, and see if there are any errors reported in the devtools console. I would also recommend loading jQuery from a CDN like CDNJS (or just the jQuery CDN) in order to improve speeds and security in production, and to simplify development (also, that way it didn’t take up any space in your workspace)


Sure here is my HTML. Thought it would be good to note I’m working with React as well.

<!DOCTYPE html>
<html lang="en">
        <meta charset="utf-8">
		<title>Recipe Box</title>
        <link href="https://fonts.googleapis.com/css?family=Bungee+Inline|Muli" rel="stylesheet">
        <link rel="stylesheet" href="../src/css/application.scss" type="text/css" />
        <meta name="viewport" content="width=device-width, initial-scale 1.0">
    <body class="site-container">
            <div class="render-target"></div>

        <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
        <script src="./bundle.js"></script>


Alright, since you’re using react, I guess ignore the CDN part. Can you post your app JavaScript? I’m not that experienced with React, but I might be able to help.


Well when I try to use it in any of those js files it just gives the “no variable” error.


Actually I’ve managed to get it working now!


hi jeff,
I’m also facing the same problem. Can you tell us how you managed to fix the issue.