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 Build an Interactive Website Introduction to jQuery Including jQuery in our Project

Can't get the javascript to execute.

For some reason I cannot get the javascript to execute, I have tried multiple different ways but I can't seem to get it to work. My code is pasted below, please help.

<script type="text/javascript" src="inductive-js/jquery.js"></script> <script type="text/javascript"> $(".qty").hide(); $(".order-now").click(function(){ var $link = $(this); $(link).next().show("slow"); return false; });

3 Answers

Tim Knight
Tim Knight
28,888 Points

Andrew, check the part where you're assigning $(this) to a variable of $link, because you're doing that you'd reference the next line like

var $link = $(this);
$link.next().show("show");

Instead of with $(link) use $link which is the name of your variable.

Hey Tim can you tell me how can i write the code so it appears like yours?

Tim Knight
Tim Knight
28,888 Points

George at the bottom of the comments textarea you'll see a "Markdown Cheatsheet", click that. It'll review how to do it for large code blocks.

Thank you, i didn't see it :)

i think you should use link.next().show("slow") because you already stored a jquery object in your link variable

Thanks a lot guys I got it to work!