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 jQuery Basics (2014) Creating a Mobile Drop Down Menu Setting a value

Christopher Parke
Christopher Parke
21,978 Points

I don't understand the question

"It says a prompt dialog will open. use Jquery to follow comments. Select correct input, set value to fullName."

These instructions seem incomplete to me. I don't know what I'm being asked for.

js/app.js
//Show Prompt Window and store value
var fullName = prompt("What is your full name?");

//Select Input with the id of #fullName
$("#fullName")
//Insert value in to full name input
index.html
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<label for="fullName">Full Name</label><input id="fullName" name="fullName" value="" disabled>
<script src="//code.jquery.com/jquery-1.11.0.min.js" type="text/javascript" charset="utf-8"></script>
<script src="js/app.js" type="text/javascript" charset="utf-8"></script>
</body>
</html>

3 Answers

Cindy Lea
PLUS
Cindy Lea
Courses Plus Student 6,497 Points

Sounds like theyre asking you to create a pop-up dialog box & have the user enter comments. Then use Jquery to sort through the comments looking for a name possibly (maybe you have to search each word to a database to see if it matches?) Then it wants you to store the name in fullname field. Yes, it is not very clear at all!

I'm confused too. I typed the same way as the first screen. Do they want me to set the variable as a jQuery representation?

Christopher Parke
Christopher Parke
21,978 Points

So what we want here is to insert the fullName variable into the "value" field in the HTML using JQuery. So, we're going to call the following:

$("#fullName").attr("value", fullName);

http://www.w3schools.com/jquery/jquery_dom_set.asp

Wow. And not using the .val()?