Gets the value select drop-down list box

I had always thought that the drop-down box to obtain the value is:. $ ( "# Id") val ();

$("input[name='name']").val()

Later found not,

Gets the value option values ​​are:

. $ ( "select [name = 'Name']") val () 

Get the Text option values:
$ ( "select [name = ' Name']"). text () 


By the way, JQ value acquired value () with .val
acquired tag text () with .text
gets set with .attr label properties ()




Guess you like

Origin www.cnblogs.com/Rocky-519/p/12120900.html