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 trialVamsi Pavan Mahesh Gunturu
4,541 PointsWhy my jquery is not working? what is the best way to test, whether is applying or not
index.php which has the following
<html>
<head>
<title> Jquery</title>
</head>
<body>
<div class="para">
<p>
This is a para
</p>
</div>
<script src="//code.jquery.com/jquery-1.11.2.min.js"></script>
<script src="js/app.js" type="text/javascript"></script>
</body>
</html>
and app.js has following
$("p").hide();
$("p").append("<button class="show"">Reveal</button>");
$("button").click(function(){
$("p").show();
});
It shows .. Unexpected identifier as syntax error in this line
$("p").append("<button class="show"">Reveal</button>");
4 Answers
Derrick Johnson
307 PointsThe http: is missing from the beginning of your jquery src property in the script tag.
Andrews Gyamfi
Courses Plus Student 15,658 PointsReplace that line with this:
$("p").append($("<button class='show'>Reveal</button>"));
It should work fine:)
Kieran Gibbons
17,434 PointsTry opening your browser console and see whether this points out any JavaScript errors
Erik Cruz
9,772 PointsThis question is a month old but for others that have the same question or similar on how to check if Jquery is working or not. Here is a great link http://css-plus.com/2010/03/6-steps-to-take-if-your-jquery-is-not-working/ that has 6 steps to take if your jQuery is not working.