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 trialSteph brace
3,391 PointsItems do not change when clicked.
Following along very carefully, tried several times, using workspace, but my items do not change when clicked.
Aisha Blake
Treehouse Guest TeacherHey Steph,
Could you post a screenshot of your HTML when you have the chance? It should work if you add the correct link before the script tag linking to your app.js
file.
ganes manandar
768 Points<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script> paste this rather than the one shown in the vid,worked for me.
Binu David
Front End Web Development Techdegree Student 11,990 Points<!DOCTYPE html> <html> <head> </head> <body> <ul> <li>Thing 1</li> <li>Thing 2</li> <li>Thing 3</li> </ul> <script src="http://code.jquery.com/jquery-3.2.1.min.js" integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" crossorigin="anonymous"></script> <script src="app.js"></script> </body> </html>
//This code is not allowing me to show the Clicked list item. I am using Edge browser but tested in firefox as well, and have the same result. The code shown above, enabled the code to work. Can you tell me why its not working with the jquery script ?
goshgarhuseynov
Front End Web Development Techdegree Student 10,873 PointsMine is working. Make sure that your app.js does have the following code in it: $('li').on('click', function() { $(this).text("Clicked!"); });
.My script is the following: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>JQuery3</title> </head> <body> <ul> <li>Test-1</li> <li>Test-2</li> <li>Test-3</li> <li>Test-4</li> </ul>
<script
src="http://code.jquery.com/jquery-3.2.1.min.js"
integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4="
crossorigin="anonymous"></script>
<script src="app.js"></script> </body> </html>
6 Answers
edmond habimana
Courses Plus Student 8,352 PointsTo solve the problem include the jQuery script before the app.js script tag, if you put it after it won't work.
peichunliu
33,154 PointsThank you, it works!
Erik Larson
16,777 PointsThis is a common error. I've learned the hard way many a time. You must call in the library before you call your application script.
Jess Ellison
234 PointsHi, I'm also having trouble and the buttons don't change when clicked on. Here is a snippet of what my code looks like:
</ul>
<script src="https://code.jquery.com/jquery-3.1.1.min.js" integrity="sha256-hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8=" crossorigin="anonymous"></script>
<script src="app.js"></script>
</body>
Jess Ellison
234 PointsThe code for app.js in the workspace is incorrect (as of 2:40PST on 9/30/16) and should be:
$('li').on('click', function() { $(this).text("Clicked!"); });
Alexander Davison
65,469 PointsFor me, everything worked just fine...
Aisha Blake
Treehouse Guest TeacherHey, Jason! Sorry for the delay. I've been out of town! I tried it just now and everything seems to be fine. Thanks for bringing this to my attention!
DavidPaul sullivan
17,377 PointsI also had to add the <script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script> to get it to work in workspaces
daveshen
2,094 Pointsyou need to add cdn before the app.js. that's why it's not working.
Daniel Stoica
2,430 PointsCan someone please explain why does this script tag need to be added BEFORE the other one?
Daniel Gonzalez
22,105 PointsDaniel Gonzalez
22,105 PointsHi Steph, what part were you not able to change? Can you send a copy of your code?