You are viewing limited content. For full access, please sign in.

Question

Question

How to select a dropdown field

asked on June 13, 2014

I want to have a drop down with options but have a default value printed in the box. How do I select its input in js and print something in it?

 

I tried this:

$('.country input').val("United States");

Which did not work. 

0 0

Answer

SELECTED ANSWER
replied on June 13, 2014

I am delighted to tell you that this is doable without JavaScript. Click the number next to a choice to make it the default.

 

3 0

Replies

replied on June 13, 2014 Show version history

You want the drop-down to display placeholder text? Or, do you want it to display one of the options as the default?

0 0
replied on January 22, 2020

What if someone was wanting to display placeholder text like "Please make a selection"? for a drop-down list selection?

0 0
replied on June 13, 2014

Actually, one of the options would probably be better. I was just thinking that I would print text out then if they want to change it they would select something from the drop down and it would replace what I had printed. But if it just displays one of the options that would be wonderful.

0 0
SELECTED ANSWER
replied on June 13, 2014

I am delighted to tell you that this is doable without JavaScript. Click the number next to a choice to make it the default.

 

3 0
replied on June 13, 2014

Seriously? Thats alot easier than I expected! Thank you.

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.