JQuery element selector usage example
This document describes the usage of jQuery element selector. Share it with you for your reference. The specific analysis is as follows:
The element selector matches all elements based on the element name.
Instance code:
Copy codeThe Code is as follows: $ ("div ")
The code above matches all div elements.
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> element selector-helping customers </title>
<Style type = "text/css">
Div {
Height: 150px;
Width: 150px;
Background-color: green;
}
</Style>
<Script type = "text/javascript" src = "mytest/jQuery/jquery-1.8.3.js"> </script>
<Script type = "text/javascript">
$ (Document). ready (function (){
$ ("Button"). click (function (){
$ ("Div"). hide ();
})
})
</Script>
</Head>
<Body>
<Div> </div>
<Button> click to hide the div element </button>
</Body>
</Html>
In the above Code, when you click a button, you can hide the div element.
I hope this article will help you with jquery programming.