1. Often use to select, each time is turned over the information, simply summed up, convenient for later viewing. 2.checked matches all selected selected elements (Checkboxes, radio boxes, etc., not including option in Select) Selected matches all selected option elements disabled matches all unavailable elements available through $ ("Inpu T[name= ' Newsletter ').prop (' checked ');Set the difference between 3.prop and attr
properties with True and false two properties , such as checked, selected or disabled using prop (),
other use of attr ()
1.html<select id= "Select" > <option value= "1" name= "Volvo" >Volvo</option> <option Valu E= "2" name= "Saab" >Saab</option> <option value= "3" name= "Opel" >Opel</option> < Option value= "4" name= "Audi" >Audi</option> </select>
2.javascript$ ("#select"). Val ("4"); Set value to 4 to select $ ("#select"). Find ("Option[name= ' Opel ']"). Prop ("selected", true); Set the item name to Pxx to select var Nowval = $ ("#select"). Val (); Gets the currently selected value of var Nowtext = $ ("#select"). Find ("option:selected"). Text (); Gets the currently selected text value Note: Similar to label [property = ' value '] This is called the attribute selector, which is the label of the attribute = value, but there is no text property inside the DOM, so option[text= ' 1 ' is illegal. Cannot be $ ("#select option[text= ' 1 ']). Prop (" selected ", true);
Select Ultra-Full super-detailed summary