This example describes the basic control methods for jquery operations. Share to everyone for your reference, specific as follows:
1. Get the control based on the style class of the control
Copy Code code as follows:
$ (". ClassName") ...//classname represents the style of the control
2. Get the control based on the ID of the control
Copy Code code as follows:
3. Get the control based on the name of the control
$ ("Input[name= ' objname ']")
... /*$ ("Check[name= ' objname ']") ... *
/$ ("[Name=objname]:checkbox")
... $ ("Select[name= ' objname ']") ...
4. Traverse a set of controls
$ (". ClassName"). each (the function () {
$ (this). attr ("title", "click Maintenance");//$ (this) Gets the object currently traversed
});
for (Var i=0 i<$ (". ClassName"). Length; i++) {
$ (". Classname:eq (" +i+ ")). attr (" title "," click Maintenance ");
}
5. Manipulating the CSS style of the control
$ ("#objId"). CSS ("property name"); Gets the CSS properties of the current object, such as: $ ("#userName"). CSS ("color"); Returns the color of UserName
$ ("#objId"). CSS ("Property name", "value");//Set CSS properties for the current control, such as: $ (" #userName "). CSS (" Color "," #FFCCFF "); set UserName color to #ffccff
6. Manipulating the normal properties of a control
$ ("input[name= ' age ']"). attr ("property name"); Gets the basic property of the control
$ ("input[name= ' Age ')"). attr ("Property name", "value");//Set the control's basic properties, such as: $ ("#input [name= ' age ']"). attr ("Size", "30" );
I hope this article will help you with the jquery program design.