JQuery ("#select_id"). Change (function () {}); 1. Add an event for SELECT, trigger var CheckValue = JQuery ("#select_id") when one of the items is selected. val (); 2. Gets the value of the Select selected item var checktext = JQuery ("#select_id: Selected"). Text (); 3. Gets the text var checkindex = jQuery ("#select_id") of the Select selected item. attr ("SelectedIndex");//4. Gets the index value of the Select selected item. Or: JQuery ("#select_id"). Get (0). SelectedIndex; var Maxindex = JQuery ("#select_id: Last"). attr ("index"); //5. Gets the maximum index value of the SELECT, or: JQuery ("#select_id: Last"). Get (0). Index; jquery ("#select_id"). Get (0). SelectedIndex = 1; 1. Set the Select index value to 1 to select jquery ("#select_id"). Val (4); //2. Sets the value of the select value to 4 to select $ ("#select_id"). attr ("value", "Normal"), $ ("#select_id"). Get (0). Value = value;// The value var count=$ ("#select_id") is set for select based on the display value of select. Get (0). options.length;for (Var i=0;i<count;i++) {if ($ ("#select_ ID "). Get (0). Options[i].text = = text) {$ (" #select_id "). Get (0). options[i].selected = true; & nbsp break; } }
JQuery ("#select_id"). Append ("<option value= ' new ' > New option</option>"); 1. Append an option (drop-down) jQuery ("#select_id") for select. Prepend ("<option value= ' select ' > Please select </option>"); 2. Insert an option (first position) jQuery ("#select_id") for select. Get (0). Remove (1); 3. Delete option (second) JQuery with index value 1 in select ("#select_id: Last"). Remove (); 4. Delete the index value in select maximum option (last) jQuery ("#select_id [value= ' 3 ']"). Remove (); 5. Delete option JQuery ("#select_id") for value= ' 3 ' in Select. Empty (); 6. Clear the drop-down list