Home >Web Front-end >Front-end Q&A >What does $ mean in jquery

What does $ mean in jquery

WBOY
WBOYOriginal
2022-05-12 14:48:194176browse

In jquery, "$" means "select", which is the abbreviation of selector and also an alias of jquery. jquery is a return function provided by the jquery library; this function can be based on the parameters in brackets. To find and select elements in html documents, the syntax is "$(document)".

What does $ mean in jquery

The operating environment of this tutorial: windows10 system, jquery3.2.1 version, Dell G3 computer.

What does $ mean in jquery?

$ is a commonly used return function in JQuery, which is defined as "select". It is the abbreviation of selector in English.

$ is actually jQuery's Another name, and jQuery is a function provided by the jQuery library.

This function can search and select elements in the html document based on the parameters in (). () can not only be IDs, but also various selectors

For example:

$(document) is to select the entire document object

The role of jquery $ symbol

1. As a jQuery wrapper, use Selector to select DOM elements (this is also the most powerful function)

For example:

$(“table tr:nth-child(even)”)

2. Utility function, as the prefix of the namespace of several common utility functions

For example:

$.trim(someString)

3. Document ready handler, equivalent to $(document).ready(…)

For example: $(function(){…}); The functions inside will be executed after the DOM tree is loaded

4. Create DOM elements

For example:

$("
how are you?
")

5. Extend jQuery

For example:

$.fn.disable = function(){…}

6. Use jQuery and other libraries

For example: the Prototype library also uses symbols. jQuery provides the noConflict function to avoid conflicts. jQuery.noConflict(); restores the symbols to the meaning defined by the non-jQuery library. .

Recommended related video tutorials: jQuery video tutorial

The above is the detailed content of What does $ mean in jquery. 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