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 trialKrystel Hagan
4,731 PointsMultiplication Calculator help (part 2)
So far I've gotten the code for my calculator to work in CodePen (http://codepen.io/anon/pen/rJHpi/), it even gives me a result when I input any numbers, and the press the Calculate button. But for some reason when I copy/paste the same code into my own files in Sublime and open them in my browser, it doesn't give me a result the same way it does in CodePen. The same code also does not work in JSFiddle (http://jsfiddle.net/VyT9k/). Here is the link for my original post: https://teamtreehouse.com/forum/multiplication-calculator-help
Any further help would be greatly appreciated!
1 Answer
Geoff Parsons
11,679 PointsMy guess is that you'll need to include jQuery when running this locally. Easiest (and arguably laziest) way is to add one of Google's hosted versions in the head of your document like so:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
Krystel Hagan
4,731 PointsKrystel Hagan
4,731 PointsOkay, that makes sense. Except when I put that exact line into my head, it still doesn't calculate a result and the box remains blank.
This is how I currently have it written in my HTML file:
Am I doing something wrong still? I'm pretty positive that I have everything written correctly
Geoff Parsons
11,679 PointsGeoff Parsons
11,679 PointsAh, might be that you have two copies of jQuery loading there. If you already have jQuery locally you can get red if the one from googleapis.com. Multiple copies of jQuery can bump into each other and make things act weird.
With just one script tag to include jQuery i was able to copy-paste your code with no issues. For reference this is what i have working on my end:
Krystel Hagan
4,731 PointsKrystel Hagan
4,731 PointsAwesome, it turns out that was exactly my problem! You sir, are a lifesaver! :D
Geoff Parsons
11,679 PointsGeoff Parsons
11,679 PointsGlad you were able to get it figured out, good luck!