1: Getting an object from a property value
The basic structure is: Object Category [Property name = ' property value ']. Example: span[title= ' First_span ')
<script type= "Text/javascript" > function Getobjvaluebytitle () { var obj = $ ("#first_div span[title=" First_span '] "); Alert (Obj.text ()); } </script>
2: Modifying property values of an object
Using the attr method provided by jquery, the basic structure for getting property values is: $ (obj). attr ("property name"); the structure of the modified property value is: $ (obj). attr ("attribute name", "property value");
<script type= "Text/javascript" > function Changeobjattrvalue () { var Objs = $ ("#first_div. MySpan"); $.each (OBJS, function (index, item) { $ (item). attr ("title", "haha"); Alert ($ (this). attr ("Nodeurl")); $ (this) = = $ (item) }); } </script>
Note: For specific objects we can arbitrarily add our own custom properties, and we can get the corresponding property values through a custom property name, such as the nodeurl in this article. 】
3: Get and modify the object's Style property value
The CSS method provided by jquery is used to get the structure of a property in the style: $ (obj). CSS ("property name"); the structure of the modified property value is: $ (obj). CSS ("Property name", "attribute value");
<script type= "Text/javascript" > function Changeobjstylevalue () { var Objs = $ ("#first_div span"); Objs.each (function (index, item) { $ (item). CSS ("Color", "blue"); }); </script>
By the comparison between the second and the third we can simply summarize: the property value of the operand (ID, name, title ...). We can use jquery's attr method; Manipulate the object's Style property (Background,color,width,height in CSS ...). We can use jquery's CSS method.
When we use jquery to facilitate the collection, we can use each method, each of the two forms of the monetization:
1): $.each (OBJS, function (index, item) {...});
2): Objs.each (function (index, item) {...});
property values for JQuery operand objects