js get the value of select display

 

html code:

<select id="myid">
    <option value ="1">one</option>
    <option value ="2">two</option>
    <option value="3">three</option>
    <option value="4">four</option>
</select>

 

js code:

var . myId = $ ( "# MyID") Val ();    // Get the value select value 
var myIdName = $ ( "# MyID Option: the checked") text ();.   // Get the value of the display select

 

Guess you like

Origin www.cnblogs.com/woods1815/p/11371524.html