Home > Article > Web Front-end > What does jquery selector start with
The jquery selector starts with the dollar sign ($()); the "$" sign means selection and is used to obtain the element object. Only by obtaining the element object can the jquery method be used to operate it, and it can be operated according to " ()" to search and select elements in the HTML document, so the selector needs to start with the "$" symbol.
The operating environment of this tutorial: windows10 system, jquery3.2.1 version, Dell G3 computer.
All selectors in jQuery start with a dollar sign: $(). The
$ symbol is mainly used to obtain element objects. By obtaining the object, you can use jquery methods to operate on it.
In JQuery, it is another name for jQuery and is a response provided by the jQuery library. Pass function, defined as "select", is the abbreviation of "selector"; the syntax "(selector)" is used to search and select elements in the HTML document based on the parameters in "()".
jQuery selectors allow you to operate on groups of HTML elements or individual elements.
jQuery selectors "find" (or select) HTML elements based on the element's id, class, type, attributes, attribute values, etc.
The example is as follows:
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>123</title> <script src="js/jquery.min.js"> </script> <script> $(document).ready(function(){ $("button").click(function(){ $("p").hide(); }); }); </script> </head> <body> <h2>这是一个标题</h2> <p>这是一个段落。</p> <p>这是另一个段落。</p> <button>点我</button> </body> </html>
Output result:
Related video tutorial recommendation: jQuery video tutorial
The above is the detailed content of What does jquery selector start with. For more information, please follow other related articles on the PHP Chinese website!