I have a classified ads site and I want in the post ads form when a user select some options from drop down list the text from that option to populate automatically an input field. I managed to get the values for that select using .val, but when i use .text the input field is filled with all options available in the select. I have a demo to understand better jsfiddle.net
2 Answers
If you only want the selected item text you have to use the :selected selector like this:
var selected_item = $(":selected", this).text()
See: jsfiddle.net
More info about the :selected Selector
1 Comment
billyonecan