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

Joao Rocha
Joao Rocha
7,172 Points

simple jQuery question

Hi there,

I think I don't quite get this challenge. It's not a jQuery coding issue but more of actually understanding what we are supposed to do, specially on this line : "//Select Input with the id of #fullName".

Thank you very much

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

//Select Input with the id of #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>

4 Answers

Jesus Mendoza
Jesus Mendoza
23,288 Points

Hey Joao, in this question you have to select the HTML Input element with the id #fullName using jQuery. HINT: $("")

Joao Rocha
Joao Rocha
7,172 Points

hi Jesus,

thanks for your reply. I get that, I'm actually much further into the course now and have managed to get every other challenge done, I just don't get this line of code. Am I just supposed to do $("#fullName"),

on that line?

Jesus Mendoza
Jesus Mendoza
23,288 Points

Yeah, seems like it and then add the value of the prompt into the value of the input element

Joao Rocha
Joao Rocha
7,172 Points

so, on the next line:

$("#fullName").val($(fullName).val())

?

Joao Rocha
Joao Rocha
7,172 Points

Right, so I got it to work now.

But I had to do

$("#fullName").val(fullName)

rather than what I typed before. I'm assuming this happens because we're storing a string into a variable so we should refer to the variable itself when we need to use its value rather than trying to get a value out of it?

Would this be why?

Thanks a lot for your help.