1. Base Selector ID Selector: $ ("#id"), style selector: $ (". ClassName"), Element selector: $ ("div"), $ ("*") Select all elements of the page Use both selectors for example: ID and element $ ("#id, div"), where you can add more for example plus a style of $ ("#id, Div,.classname"); 2. Property
Note:$ ("#tt") gets the object forever, without this element on the instant page. Therefore, when you want to use jquery to check whether an element exists on a Web page, you cannot use the following code : The IF ($ ("#tt")) {} should be judged based on the length of the element obtained, the code is as follows: if ($ ("#tt"). length>0) {} or Convert DOM object to determine the code as follows: if ($ ("tt") [0]) {} Basic Selector #id ID
jquery offers a lot of easy-to-use methods, and the jquery filter selector is one of them. The filter filters the required DOM elements primarily through specific filtering rules, using a colon (:) switch.First, basic filter: FirstSelect first element (single element)$ (' Li:first '): LastSelect the last element (single element)$ (' li:last '): Not (selector)Wait until class is not a blue element$ (' Li:not
CSS creates the background:In order to make the style of the Web page more rich, but also in order to let the content and style of the page can be split apart, CSS is born from this idea, CSS is cascading style Sheets acronym, meaning cascading style sheet.With most of the css,html in the style of the label is discarded, HTML is only responsible for the structure and content of the document, the form of expression to the css,html document becomes more concise.CSSBasic syntax and page referencesC
Single selector in selector: Association selector fileNo. 01 Step: Writing Select.css" Utf-8 " ; /* The exam class for the B tag in the span tag */ span b.exam{ background-color:#036; Color: #F00 } /*theb tag in the span tag, a label in the V label */span B a v.mor{ background-color: #0F0; Color: #C0C }No. 02 Step: Write the HTML code:"-//W3C
Selectors are the foundation of jquery, in jquery, for event handling, traversing DOM and Ajax operations all depend on selectorsAdvantages of the JQuery selector:A concise notationA perfect event handling mechanismFirst, the basic selectorThe basic selector is the most commonly used selector in jQuery and the simplest selector, which finds DOM elements by elemen
Implementation of native html element selector, similar to jquery selector and jquery Selector
To be a front-end, you need to select elements. Although jquery and various major js libraries have already helped me build the wheel, I want to implement one by myself, so the project is not busy, add your own js file. The following is the implementation code. You can
One, intersection selectorHtmllang="EN" >Head>Metacharset="UTF-8" >TITLEGT;15-CSS intersection selector. htmlTitle>Style> P. para1{ColorRed}Style>Head>Body>P>, I'm a paragraph.p>p> I'm the paragraph p>p class="Para1" > I'm the paragraph p>p class="Para1" > I am the paragraph p>paragraph p>body>html> Two, and set selectorHtmllang="EN" >Head>Metacharset="UTF-8" >Title>16-css and set selector. htmlTit
First, structure (position) pseudo-class selector (:)1,: First-child2,: Last-child3,: Nth-child (n) or : Nth-child (2n) or : Nth-child (2n+1) Body> ul> Li>I was the first oneLi> Li>I'm the second one.Li> Li>I'm the third one.Li> Li>I'm the fourth one.Li> Li>I'm the fifth one.Li> Li>I'm the sixth one.Li> Li>I'm the seventh one.Li> Li>I'm the eighth one.Li> Li>I'm the nineth one.Li>
CSS/JQuery element selector |, logical operations of selector, cssjquery Selector
When using CSS or JQuery to select an element, we often need to perform the or | operation on the condition.
| In JQuery or CSS is very common and very simple. It is separated by commas.
Selector1, selector2, selectorNFor example, if you want to select div or span, you can
The visibility selector of the jQuery selector. The jquery selector is visible.
Function show (ele) {if (ele instanceof jQuery) {// if it is a jQuery element $ ("# show "). append ('element length = '+ ele. length) // display "element length = (number of ele. s)"} else {// if it is not a jQuery element alert (ele + 'not a jQuery object')} execution result: elem
Child element selector of jQuery selector and jquery selector Element
Note:
JQuery implementation: nth-child (n) is strictly from CSS specifications, so the n value is "index", that is, count from 1,: nth-child (index) starting from 1, while eq (index) starts from 0.
Attribute filtering selector of jQuery selector and jquery selector Filtering
[Attr = "value"] and [attr * = "value"] are the most practical attribute selectors.
[Attr = "value"] can help us locate different types of elements, especially the operations on form elements, such as input [type = "text"], input [type = "checkbox"] and other [attr * = "value"] can hel
CSS is a language for on-screen rendering Html,xml, CSS is mainly used in the corresponding elements to apply the style, to render the relative application of the elements, then we choose the corresponding element is very important, how to select the corresponding element, at this time we need to say the selector. Selectors are primarily used to determine the DOM element nodes in the HTML tree structure.Commonly used selectors for CSS3 are:Here are a
The selector does not have a fixed definition, and in some ways the jquery selector is very similar to the selector in the style sheet. Selectors have the following characteristics:1. Simplifying the writing of code2. Implicit iterations3. No need to determine if an object existsWhere "$" is an integral part of the selector
Detailed description of CSS3 basic selector and CSS3 Selector
CSS SelectorI think everyone is familiar with it, because it is used every day, butCSS3 SelectorI think it is still difficult for many friends to use the nth selector in CSS3. From now on, let's take a look at the differences between their versions from the beginning.CSS
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.