Summary of Knowledge points
1, Properties
Property (if your selector selects multiple objects, the default is to return only the first property),
attr (Property name | property value)
-one parameter is the value of the Get property, and two parameter is the Set property value -click the load image Example
Removeattr (property name)
-delete the value of the property
Prop (property name | property value)
-Return of the property Value is Boolean type
-Radio, deselect, cancel example
Removeprop (property name)
-delete property's value
Loop: Each (two loop example)
-$.each (Array/object, function (I, v) {})
-$ ("div"). each (function () {})
CSS class
-AddClass Add Class Properties
-Removeclass Remove class attribute
-toggleclass Switch | Toggle (remove, no add)
Bulb example
HTML code/text/value
No parameters is to get the corresponding value,
have parameters to set the corresponding value
-. HTML () to add HTML tags. html ("<span> la La. </span> ")
-. Text () to add texts. Text (" Cheer up. ")
-. Val ()
Input: A parameter that gets the value inside the input box
checkbox: A parameter that gets the value of the values
Select:
Radio: Get Value
Multi-select: Get an array, set the time also if the array
One, property operation
<! DOCTYPE html>Ii. Examples of pictures
1, attr
(1) Get properties and set property values
(2) Setting custom attribute values
2, Removeattr
3, prop
4, Removeprop
Third, the two ways of the cycle in jquery
way One li = [11,22,33]; $.each (Li,function (i,v) { console.log (i,v)//0 //1 //2 })// mode two $ (". C1"). each ( function (i,v) { console.log (i,v)//The v here Gets the label// 0 <div class= "C1" >hah</div>// 1 <div class= "C1" > Year </div>// 2 <div class= "C1" > Eva </div> console.log (v.innertext) //Get text }) </script>
Exit Loop ============================
Third, the attention of one of the following questions:
Workaround
Web front End "11th" jquery Property related actions