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 trialMarcus Schumacher
16,616 PointsHaving problem with this simple JQuery testing project
Here is the html:
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="project.css">
</head>
<body>
<div id="wrapper">
<form>
<label>What is your name?</label>
<input>
<p><span>This is the comment given to you</span></p>
</form>
</div>
<script src="http://code.jquery.com/jquery-1.11.0.min.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" src="project.js"></script>
</body>
</html>
And here is the JS:
//Add a GO Button over the comment
$("p span").hide();
$("p").append("<button>GO</button>");
$("button").click(function(){
$("button").hide();
$("p span").show();
});
EXPLANATION: I am trying to make a simple little game where user inputs name and eventually I will have it so there is a comment spat out with their name in it. Right now I am trying to make it so the go button is hidden after you press it and the p comment is shown. When you press the go button, it disappears and the p appears FOR ONLY A SPLIT SECOND. Why doesn't this hide and show them permanently?
Thanks for the help! :D