tags:

views:

48

answers:

1

I would like to print the selected values of all selects using jQuery. I did it like this, but I feel that there is a nicer way to write the same. Am I right ?

$("select").each(function() {
    alert(this.options[this.selectedIndex].value);
});
+2  A: 

Yes.

alert($(this).val());

jQuery's val function will return the value of the selected option from a <select> element.

SLaks
Thanks for a quick answer !
Misha Moroshko