The following is an introduction to the operation of jquery on select. It is very good. The content introduction is as follows:
The html tag of select is as follows:
<select class="xxx" id="yyy"><option></option>...<option></option></select>
1. Set the option with value as "lll" to select
$('#yyy').val("lll");或者$('.xxx').val("lll")
can be used to let select automatically select an item, such as selecting an item whose value passed from the background is the same as the value of the option
2. Set the text to "lll" to select the option
$('#yyy').find("option[text="lll"]").attr("selected","selected");或者$('。xxx').find("option[text="lll"]").attr("selected","true");
3. Get the value of the currently selected item
$('#yyy').val(); or $('.xxx').val();
4. Get the text of the currently selected item
$('#yyy').find("option:selected").text()或者$('#yyy option:selected').text()
The above is the detailed explanation of the select operation in jQuery introduced by the editor