Detailed description of the select operation by jquery and detailed description of jqueryselect
The select html Tag is as follows: <select class = "xxx" id = "yyy"> <option> </option>... <option> </select>
1. select option with the value set to "lll"
$ ('# Yyy'). val ("lll"); or $ ('. XXX'). val ("lll ")
It can be used to allow select to automatically select an item. For example, the items with the same value as the option value from the background are selected.
2. select option when text is set to "lll"
$ ('# Yyy'). find ("option [text =" lll "]"). attr ("selected", "selected"); or $ ('. Xxx '). find ("option [text =" lll "]"). attr ("selected", "true ");
3. Obtain the value of the selected item.
$ ('# Yyy'). val (); or $ ('. XXX'). val ();
4. Get the text of the selected item
$ ('# Yyy'). find ("option: selected"). text () or $ (' # yyy option: selected'). text ()