1. Common ways to get objects
$ ("*") means get all objects ( not normally used )
$ ("#XXX") ' Get id=xxx Element Object ( common )
< Span style= "Color:rgb (75,75,75); Font-family:arial, song body; font-size:16px; Line-height:19.5px "> $ (". XXX") ' acquired class= Element object of XXX ( Common)
$ ("div") ' tag Selector selects all div elements (common)
$ ("Input[name= ' uname ')") gets the element object of the input tag name= 'uname' (Common)
Such as:
Self.find ("Input[name= ' Complany ')"). CSS (' border ', ' #FFB240 1px solid '), Self.find ("Textarea[name= ' Messcont ']"). css (' Border ', ' #FFB240 1px solid ');
The above selection method can be
spaces with greater than sign >, plus + and tilde ~Used in combination, about the use of rules, you can refer to here (http://blog.csdn.net/hsd2012/article/details/51750105) in this blog, forgot to add the use of a comma combination, here is a case with a comma combination
To obtain a div with class message, the code is as follows:
<div class= "message" >gegrew</div><span class= "message" >ageaw</span><script type= "text/ JavaScript "src=" js/jquery-1.7.1.min.js "></script><script type=" Text/javascript ">console.log ($ (". Message,div "). html ());</script>
2. Other object acquisition methods$ ("Element[attribute = ' Ceshi ']") get all elements with a property of Ceshi
$ ("Element[attribute! = ' Ceshi ']") gets all elements that have a property that is not Ceshi
$ ("Element[attribute ^= ' Ceshi ')" gets all elements that have a property that is not the beginning of the Ceshi
$ ("Element[attribute *=' Ceshi ']" ' gets all elements that contain the beginning of the Ceshi of a property
<span class= "message" src= "Hello" >hello</span><span class= "message" src= "Byebye" >byebye</span ><script type= "Text/javascript" src= "js/jquery-1.7.1.min.js" ></script><script type= "text/ JavaScript ">console.log ($ (" span[src = ' Hello '] "). HTML ());</script>
3. Get the properties of an object $ ("element"). attr (Key) Gets the properties of an element
$ ("element"). attr (Key,value) sets a property for an element
About jquery Gets the properties and values of an object