In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly shows you "what are the basic knowledge points of getting started with jQuery", which is easy to understand and well organized. I hope it can help you solve your doubts. Let me lead you to study and learn this article "what are the basic knowledge points of getting started with jQuery".
What is jQuery?
Jquery is a framework encapsulated by js for rapid development.
Advantages: write less and do more to deal with compatibility between browsers
Encapsulate a large number of syntax of js
A large number of methods
A lot of learning methods and dom and the like
Jquery libraries can be introduced in head body.
Introduce jquery files (libraries) when writing jquery code
To write regular jquery code.
(jquery code written by the library code first)
Window.jQuery==window.$=jQuery
So writing in jquery is done with $
When getting the jquery dom, pay attention to whether the element is initialized. The following load functions are required regardless of initialization
Note: the jquery load function is similar to the browser's load completion event _ window.onload
$(document) .ready (function () {console.log ("load complete"); console.log ($("# btn"));})
Abbreviated as
$(function () {})
How to get dom elements
Note: the jquery object returns a collection that uses the
Jquery code can do implicit iterators (it can do a lot of operations)
1) basic selector
Id class element * compound element Select $("button,input")
2) hierarchical selector
Get child element + get next element ~ get all elements and spaces after the current element
3) basic filter
All elements of first last not except the current one
Even odd gets the odd and even numbers of the index
Eq gt lt gets elements equal to or greater than the index
Header gets all the h tags
Focus acquires focused elements
Root acquires html directly
4) content selector
Contains contains something
Empty empty element
Has contains an element
The element that parent matches must be the parent element
5) visibility
Hidden hiding
Visible display
6) attributes
[attribute] an element that contains an attribute
[attribute=value] / / specify that an element satisfies the attribute = attribute value
The attribute does not equal the value or does not contain the attribute
[attribute^ = value] / / what does it start with
[attribute$=value] / / what ends with
[attribute=value] / / contains a value
$("attrSel2 [attrSel1] [attrSelN]") all have elements that they all have
$("roomon [id = 'btn'] [class='btn']") / / both have to satisfy the relationship with
$("button [idled id btn']]; / / if you have id, consider whether id is not equal to this value. If there is no id, you can only consider whether class satisfies the conditions and can be obtained.
7) Child element filter selector
First-child 's first child
First-of-type1.9+: if you write a specified tag, get the first one in the specified tag, if you don't write, get the first one in all types of tags.
Last-of-type1.9+ matches the last one of the same type
The first child of nth-child begins.
: nth-last-child () 1.9 + upside down, which child begins?
: nth-last-of-type () 1.9+ then press the type to get the last one in the tag
: nth-of-type () 1.9+ get the nth item in the tag by type after going there
The element that only-child matches must be the only child of the parent element
Only-of-type1.9+/ gets all the tags of the same type in the parent element
8) form element selector
: input matches all input, textarea, select and button elements
Text gets the value of the single-line text box
: password gets the password box's
: radio / / get the radio button's
: checkbox / / get the check box
: submit / / get the form submitted
: image
: reset get reset button
: button gets button
: file gets the file path
These are all the contents of this article entitled "what are the basic knowledge points of getting started with jQuery". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.