How Can i get the value of a开发者_开发百科n Selected object like select Id="foo" there are many options how can i get the value of the current selected?
The surest way for cross-browser support is
var foo = document.getElementById('foo');
var val = foo.options[foo.selectedIndex].value;
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
document.getElementById('foo').value
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论