AKor
AKor

Reputation: 8882

jQuery display value when dropdown menu is used

I used to have a text input in place of the dropdown, where you would type in a number. However, I wanted something a little more logical, so I converted it to a dropdown. My jQuery code only works if I use a text-input, unfortunately.

How would I make it work in this situation?

Here's my code: http://slexy.org/view/s2rNXE3OcO

One last thing - how would I fix the height of the dropdown menu to around 8 values and have a scrollbar for the rest of them?

Upvotes: 0

Views: 387

Answers (2)

Harish
Harish

Reputation: 2324

<select name="element_3" id="element_3">

is given by you

$('input[name=select]').change(function(){
   $('#select').text($(this).val());
});

is this a mistake?

Upvotes: 0

Aaron Hathaway
Aaron Hathaway

Reputation: 4315

In your change() event handler that sets the display you are referrencing an input with a name of select. I think that selector should instead just be $('#element_3') as can be seen here.

Upvotes: 1

Related Questions