Introduction to jquery:
1. Introduction: Download jquery on the official website will download to 1.x, 2.x, 3.x three series, Silver corner King said 1.x series compatibility, function can also meet.
2. Format: In the official website no matter download that series, will see there are two formats, A.jquery-1.12.4.js b.jquery-3.1.1.min.js; the second is the compression format, if it is written in the code stage using the first convenient for our own good-looking, If the project is on the line stage, it is recommended to replace the second one, saving space;
How to refer to jquery in 1.html
<!DOCTYPE HTML><HTMLLang= "en"><Head> <MetaCharSet= "UTF-8"> <title>Title</title></Head><Body> <DivID= "I1">123</Div> <Scriptsrc= "Jquery-1.12.4.js"></Script> <Script> //Here you can refer to the jquery method //If you use jquery as a keyword to invoke the jquery method, you can also use a $ to replace jquery; here's a tag that gets the ID equals I1.
JQuery ('#i1') </Script></Body></HTML>
Comparison of results obtained by 2.jQuery and document acquisition
A.jquery Get results More, we can understand for a moment to get an array, while domcument gets the result is a string, see example:
B. The conversion of both types
JQuery---->document:jquery results [0] Yes, visible
Document---->jquery: Put the result in $ () Yes
3. Selector
a.ID Selector
$ ("#id") or jquery ("#id")
B.class Selector
<div class = ' C1 ' ></div>
$ (". C1") Select a label with class equal to C1
C. Tag Selector
<Divclass= ' C1 '> <a>F1</a> <a>F2</a></Div><Divclass= ' C1 '> <a>F3</a></Div><Divclass= ' C1 '></Div>
$ (' a ') Select all a tags
D. Tag combination Selector
<div id = "i10"class= ' C1 '><a>F1</a><a>F2</a>
</Div><Divclass= ' C1 '> <a>F3</a></Div><Divclass= ' C1 '></Div>
$ (' a,.c2, #i10 ') Select a tag and class equals C2 and ID equals 10 label
E. Hierarchy Selector
Level filter one, $ (' #i1 ') find the label with ID equal to 11---->$ (' #i11 a ') to find all the a tags under the tag id equals 11 (descendants)
Level filter two, $ (' #i1 ') find the tag with ID equal to 11---->$ (' #i11 >a ') find all the A tags under the tag with ID equal to 11 (son level a tag, not looking deep)
F: Basic Selector
<ul> <Li>List Item 1</Li> <Li>List Item 2</Li> <Li>List Item 3</Li> <Li>List Item 4</Li> <Li>List Item 5</Li></ul>
$(‘li‘)Find all the LI tags---->$ (' Li:first ') find all the Li tags in the first
$(‘li‘); Find all the LI tags---->$ (' li:last ') find all the Li tags in the last one
<Table> <TR><TD>Header 1</TD></TR> <TR><TD>Value 1</TD></TR> <TR><TD>Value 2</TD></TR></Table>
$("tr");找到所有的tr标签--->$("tr:eq(1)");再找的所有的tr标签中获取索引为1的tr标签;注意这里的索引是从0开始的 看一
G: Property Selector
H: Form Object properties
To add the use of the disabled attribute in the input tag, when an input tag is added with a disabled attribute, it indicates that the input box cannot input data, see the code:
<type= "text" disabled>
So the question is, what if we're looking for a page where those input tags have disabled properties?
$ ("input:disabled")
1
Life is short, I use python--Day17 jquery to explain