Example of jQuery object selector attribute usage, jqueryselector
This document describes how to use the selector attribute of a jQuery object. Share it with you for your reference. The specific analysis is as follows:
This attribute returns the original selector passed to jQuery, that is, the Selector Used by jQuery to match the current element.
The selector attribute can be used with context to precisely detect selector queries.
Syntax structure:
Copy codeThe Code is as follows: $ ("selector"). selector
Instance code:
Copy codeThe Code is as follows:
<! DOCTYPE html>
<Html>
<Head>
<Meta charset = "UTF-8">
<Meta name = "author" content = "http://www.bkjia.com/"/>
<Title> helping customers </title>
<Script type = "text/javascript" src = "mytest/jQuery/jquery-1.8.3.js"> </script>
<Script type = "text/javascript">
$ (Document). ready (function (){
$ ("# Btn"). click (function (){
$ ("Div"). text ("the original selector is:" + $ ("ul li"). selector );
})
});
</Script>
</Head>
<Body>
<Div> </div>
<Button id = "btn"> click to view instances </button>
</Body>
</Html>
The code above uses the selector attribute to return the selector Used by $ () to match the element.
I hope this article will help you with jQuery programming.