jquery Basic Selector Selection element usage Introduction _jquery

Source: Internet
Author: User
Copy Code code as follows:

<!--
1. Basic selector: Is the most frequently used selector in jquery, which consists of an element ID, Class, element name, multiple selectors, which enables you to find most page elements through a basic selector
jquery Selector Detailed
Depending on the elements in the obtained page, you can divide the jquery selector into: basic selector, hierarchy selector, filter selector, form selector four categories. Among them, in the filter selector can be divided into: Simple filter selector, Content filter selector, visibility filter selector, attribute filter selector, child element filter selector, Form object attribute filter Selector 6 kinds
-->
<title></title>
<!--use the jquery basic selector to select elements: one page contains two <div> tags, one for setting the ID property and one for setting the Class property; we add a <span> tag, all the element initial values are hidden, The corresponding page tags are then displayed through the jquery base selector. -->
<script src= "Jquery-1.9.1.js" type= "Text/javascript" ></script>
<style type= "Text/css" >
Body{font-size:12px;text-align:center;}
. clsframe{width:300px;height:100px}
. clsframe div,span{display:none;float:left;width:65px;height:65px;border:solid 1px #ccc; margin:8px}
. Clsone{background-color: #eee}
</style>
<script type= "Text/javascript" >
$ (function () {//ID match element
$ (' #divOne '). CSS (' Display ', ' block ');
})
$ (function () {//element name match element
$ (' div span '). CSS (' Display ', ' block ');
})
$ (function () {//Class matching element
$ ('. Clsframe. Clsone '). CSS (' Display ', ' block ');
})
$ (function () {//Match all elements
$ (' * '). CSS (' Display ', ' block ');
})
$ (function () {//merge matching elements
$ (' #divOne, span '). CSS (' Display ', ' block ');
})
</script>
<body>
<div class= "Clsframe" >
<div id= "Divone" >
Id</div>
<div class= "Clsone" >
Class</div>
<span>SPAN</span>
</div>
</body>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.