Home  >  Article  >  Web Front-end  >  What does jQuery have to do with JavaScript?

What does jQuery have to do with JavaScript?

青灯夜游
青灯夜游Original
2020-11-24 15:56:278607browse

JavaScript is a scripting language, and jquery is a JavaScript function library, a collection of JavaScript functions; jquery is based on the JavaScript language, encapsulates the native methods of JavaScript, provides a simple function interface, and simplifies the operation of JS .

What does jQuery have to do with JavaScript?

JavaScript is a scripting language, mainly used in browsers to implement the operation of document objects on web pages and the processing of some user interactions.

jQuery is a JavaScript code library (or commonly called a class library). It brings together some functions that are often used in JavaScript development to facilitate developers to use them directly without having to use them again. Write a lot of code with native JavaScript statements while achieving consistent results across different browsers. It is one of the most popular JavaScript libraries currently.

The relationship between jQuery and JavaScript

jquery is written based on JavaScript, and all jquery is composed of JavaScript code. jquery encapsulates the native methods of JavaScript, provides a simple function interface, and simplifies the operation of JS.

Mutual conversion between Js objects and Jquery objects

1. Conversion of Js objects into Jquery objects

var p = document.getElementById('p');
var $obj = $(p);

2. Conversion of Jquery objects into Js Add $ to the variables in object

var $bh = $('#J_btn');
var jsObj = $bh[0];//相当于$bh.get(0)

Jquery, for example:

$li = $('ul li');

For more programming-related knowledge, please visit: Programming Learning Course! !

The above is the detailed content of What does jQuery have to do with JavaScript?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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