Sunday, October 20, 2013

get the selected value from a dropdown in JavaScript

var foo = bar.options[bar.selectedIndex].value;

Addendum 4/22/2015: I think that all one has to do anymore is: var foo = $('#bar').val();

No comments:

Post a Comment