How Can i get the value of an Selected object like select Id="foo" there are many options how can i get the value of the current selected?
3 Answers
The currently selected option in a <select> can be retrieved by inspecting the value attribute:
Using jQuery:
$("#foo").val()
Without jQuery:
document.getElementById("foo").value
1 Comment
Tim Down
value is a property, not an attribute. I blame jQuery for creating this muddle in people's minds with its ill-named attr() method.document.getElementById('foo').value
1 Comment
Kemo
sorry, Philippe answered while I was answering