Is jquery a js function library?

WBOY
Release: 2022-07-26 17:27:59
Original
2176 people have browsed it

jquery is a JavaScript function library; jquery is a lightweight, fast, and concise JavaScript library. jquery greatly simplifies JavaScript programming, encapsulates common JavaScript function codes, and provides a simple JavaScript Design mode, optimize HTML document operation, event handling, animation design and Ajax interaction.

Is jquery a js function library?

The operating environment of this article: Windows 10 system, jquery version 3.6.0, Dell G3 computer.

jquery is a js function library

jQuery is a fast and concise JavaScript library, which greatly simplifies JavaScript programming. The purpose of jQuery's design is "write less, do more", which means writing less code and doing more things. It encapsulates common JavaScript function codes, provides a simple JavaScript design pattern, and optimizes HTML document operations, event processing, animation design and Ajax interaction.

jQuery is a fast and concise JavaScript framework. It is another excellent JavaScript code library (or JavaScript framework) after Prototype. The purpose of jQuery's design is "write less, do more", which means writing less code and doing more things. It encapsulates common JavaScript function codes, provides a simple JavaScript design pattern, and optimizes HTML document operations, event processing, animation design and Ajax interaction.

The core features of jQuery can be summarized as follows: It has a unique chain syntax and a short and clear multi-functional interface; it has an efficient and flexible CSS selector, and can extend the CSS selector; it has convenient plug-in extensions Mechanism and rich plug-ins. jQuery is compatible with various mainstream browsers, such as IE 6.0, FF 1.5, Safari 2.0, Opera 9.0, etc.

Syntax and selectors

jQuery syntax is to select HTML elements and perform certain operations on the selected elements.

Basic syntax: $(selector).action()

Dollar sign definition jQuery

Selector (selector) "query" and "find" HTML elements

jQuery's action() performs operations on elements

jquery entry function:

$(document).ready(function(){
     // 执行代码
});
Copy after login

or

$(function(){
    // 执行代码
});
Copy after login

selector

#id selector

Click the button to hide the selector with id test

$(document).ready(function(){ 
$("button").click(function(){ 
$("#test").hide(); 
}); 
});
Copy after login

.class selector

Click the button to hide the selector with class test

$(document).ready(function(){ 
$("button").click(function(){ 
$(".test").hide(); 
}); 
});
Copy after login

Event

$().click(function(){
….
})
Copy after login

For other events, please refer to the API at the end of the article

Get and set the css class

addClass() - Adds one or more classes to the selected element

removeClass() - Removes one or more classes from the selected element

toggleClass() - Add/delete class switching operation for selected elements

css()-Set or return style attributes

Example:

$(document).ready(function(){
$("button").click(function(){
$("body div:first").addClass("important blue");
});
});
.important {
font-weight:bold;
font-size:xx-large;
}
.blue {
color:blue;
}
Copy after login

Related tutorial recommendations: jQuery video tutorial

The above is the detailed content of Is jquery a js function library?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template