jquery get element reference: http://www.w3school.com.cn/jquery/jquery_selectors.asp1. (1) $ (document). Ready ()-->$ ()-->$ entire document(2) $ ("P") $ ("button") HTML tag(3) $ (this) current object1 $ (function() {2 $ ("P"). Click (function() {3 $ ( this). Hide (); 4 }); 5 });(4) Get the object by ID $ ("#divs")(5) Get the object by Class $ (". Clsdiv")(6) Get the object by name $ ("[name= ' sql ']")2.
If the object being obtained is a jquery object, precede the variable with $, as follows:var $variable = JQuery ObjectIf you get a DOM object, it is defined as follows:var variable = dom Object1,jquery objects into DOM objectsjque
This article analyzes the transformation and distinction of DOM objects and jquery objects. Share to everyone for your reference. The specific analysis is as follows:
JQuery Hello World Program:
$ (document)-Comparison of Ready and window.onload
First look at the window.onload:
Copy Code code as follows:
Window.onload = SayHello;
matching element
$ ("P"). width (); Gets the value (px) of the current calculation for the first matching element. $ (window). width (); Gets the width of the current window
$ ("P"). Width (20); Sets the value of the CSS width property for each matching elementElement manipulation
Creating a Node Element
var $div = $ ("
Internal Insert Node
Internal inserts, which are added inside the element as child nodes of the element.
Appe
. jquery design will change the way you write JavaScript code, reduce the complexity of your learning to use JS to operate the Web page, improve the efficiency of Web page JS development, Whether for JS beginner or senior expert, jquery will be your first choice. JQUery is suitable for designers, developers, and those who are good for business development, and
: {},//To prevent the as loop in the first place assign an empty array //In case There is no cookies at all. Also prevents odd result when //calling $.cookie ().cookies = Document.cookie? Document.cookie.split ('; ‘): [], I= 0, L=cookies.length; for(; i ) { varParts = cookies[i].split (' = ')), name=Decode (Parts.shift ()), Cookie= Parts.join (' = ')); if(Key = = =name) { //If second argument (value) is a function it ' s a converter ...result =Rea
1.jQuery Objects and Dom objectsDom object, which is the object we get with the traditional method (JavaScript), the jquery object is the object obtained by the jquery class library selector;Copy the code code as follows:var domobj = document.getElementById ("id"); Dom Objec
1. Understanding jquery
DOM object: The Document Object model
jquery object: An object that is produced after wrapping a DOM object through jquery. This is unique to jquery objects, where you cannot use any of the
elements by class name:. Error (class selector)Expand:How to make the error message newlineThe error prompt is generated by default, immediately following the corresponding inputIn the appropriate location, add your own tag Built-in error hints, when used, do not need to write the messages section to get the defaultInternationalization:The same software displays different languages, built-in Language pack implementations, dist filesYou can provide the checksum yourself in HTML:1. In the script
This article mainly introduces DOM loading and event execution in JQuery, analyzes the principles and implementation methods of DOM loading and event execution in jQuery, and introduces windows. onload method and $ (document ). the difference between the ready () method. If you need it, you can refer to the following e
First, using jquery to create a nodeNodes are the DOM infrastructure. Depending on the DOM product specification, node is a broad concept that contains elements, attributes, bodies, documents, and so on. In the actual development process, to create dynamic content, the main operations of the node include elements,Properties and text.See example example 4-1:Run ef
name", FN) =>removeeventlistener; if it is possible to remove an event handler, the binding must be bound with the real name function, cannot use anonymous functions, Overload: A, without any parameters: Remove all event handler bindings on the element, B, Takes only one event name parameter: Removes all function objects specified by the event name binding on the element, and C, with two parameters: Removes only the function object that specifies the execution of the event name binding on the e
Style operations. CSS () and element data storage.1. The CSS () method is used to get the calculated value of the element style property or to set the element's CSS properties2. CSS () 2 ways to get the calculated value of an element style attribute. CSS (PropertyName) Gets the computed value of the style attribute that matches the first element in the collection of elements. CSS (propertynames) passes a set of arrays, returning an object result 3 . CSS () 3 ways to set CSS properties for an ele
CSS Properties
Description
CSS ()
Sets or returns the style properties of the matching element.
Height ()
Sets or returns the height of the matching element.
Offset ()
Returns the position of the first matching element relative to the document.
OffsetParent ()
Returns the nearest positioned ancestor element.
Position ()
Returns the position of the first matching element relative to the parent
When you start learning jquery, you may not be able to figure out which jquery objects are and which are DOM objects. As far as DOM objects are not explained, we have too much contact, and the following focuses on jquery and the conversion between the two.What is a
1.DOM objectsThe DOM is actually a document model that is described in an object-oriented manner. The DOM defines the objects that are required to represent and modify the document, the behavior and properties of those objects, and the relationships between those objects.DOM is an application programming interface (API) for HTML and XML according to the
In the JQuery.fn.init function, the final result is to put the DOM elements into a collection of jquery objects, which we can pass in a single DOM element or a collection of DOM elements directly to the collection of jquery objects. However, if the first argument is of type
Introduction jquery is a fast, concise JavaScript framework that is a good JavaScript code base after prototype (or JavaScript framework)。 The purpose of jquery design is "write Less,do more", which advocates writing less code and doing more things. It encapsulates the functionality code common to JavaScript, providing a simple JavaScript design pattern that optimizes HTML document
This article mainly introduces DOM operations in jQuery. For more information, see
DOM operations in jQuery
DOM (Document Object Model-Document Object Model): an interface unrelated to browsers, platforms, and languages. you can use this interface to easily access all stand
What is the difference between a DOM object and a jquery object?
A deep understanding of the differences between jQuery objects and common DOM objects. Mutual conversion: Q1Q1, js Writing Method: document. getElementById ('save'). disabled = true;In jquery, I wrote $ ("# sav
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.