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 trialDorota Kolasinska
3,078 PointsHide and show doesn't work at all on Firefox.
This is my code:
jQuery(".warning").hide();
jQuery(".warning").show("slow");
6 Answers
Pete Arevalo
12,653 PointsHi Dorota,
Make sure you are including the jQuery library, also your code is not properly formatted, the semicolon is used at the end of each expression, also you have already grabbed the .warning
element, so there is no reason to do it twice if you are performing both actions on the same element in a sequence. It should look something like this:
$('.warning').hide().show('slow');
here is a live example https://jsfiddle.net/m1d4suc0/1/
Bruce Morrison
989 PointsI found when I opened console that there was an error: "The character encoding of the HTML document was not declared. The document will render with garbled text in some browser configurations if the document contains characters from outside the US-ASCII range."
The solution can be found here:
[example link]https://teamtreehouse.com/community/character-encoding-html-not-declared
I'm not 100% confident that this caused the error, since subsequently removing that meta tag didn't revert the behavior (i.e. it continued to work correctly when I removed it). So... hopefully this is helpful and not a red herring :)
Pete Arevalo
12,653 PointsHi Duke,
If you are trying to include Jquery in jsfiddle, copy this cdn: https://cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0/jquery.js and paste it in the external resources box show here http://imgur.com/KqUG6LX and press the blue plus sign to add. If you are looking to add it in your own personal project, just add it to the bottom of your index page, before the closing </body> tag. It should look like this <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0/jquery.js"></script>
Dorota Kolasinska
3,078 PointsTreehouse, please, there is no the "best answer".
leonvsthings
12,236 PointsDorota, unfortunately in the video an older version of jQuery is being used. Please try including the latest version of jQuery in your code and try again. The code below will link you the latest jQuery from the Google CDN.
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
Thomas Katalenas
11,033 Pointsworks in chrome for me
Dorota Kolasinska
3,078 PointsDorota Kolasinska
3,078 PointsHi Pete, Since I'm using treehouse workspace, jQuery library is included already. Also, the code I pasted above, is dot to dot such as code written by the teacher. You're right that there is no reason to grabb .warning element twice, but it's not a mistake which could cause the problem. Identical code works when Andrew preview it. What I found, was that my code doesn't work in treehouse workspace, but it works after I downloaded project folder to my computer. Therefore, I believe that the problem is caused by treehouse workspace somehow.
Mars Epaecap
5,110 PointsMars Epaecap
5,110 PointsHi Pete could you please explain how to include the JQuery Library?