This example describes the jquery element selector usage. Share to everyone for your reference. The specific analysis is as follows:
The element selector matches all elements based on the element name.
Instance code:
Copy Code code as follows:
The above code matches all the DIV elements.
Instance code:
Copy Code code as follows:
<! DOCTYPE html>
<meta charset= "Utf-8" >
<meta name= "Author" content= "http://www.jb51.net/"/>
<title> element Selector-cloud-Habitat Community </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>
<body>
<div></div>
<button> Click to hide div elements </button>
</body>
In the above code, the DIV element can be hidden when the button is clicked.
I hope this article will help you with your jquery programming.