There have been some methods that have been used by jquery to make it impossible to directly use JavaScript, and it is not understood at the beginning, and now the case knows that the object that jquery obtained is not the same object that we normally get with getElementById. So some novice is very confused, why ${"#Element"} can not directly InnerHTML, this is the reason, the solution please see below. co
label name of the child elementelement.innerhtml to manipulate child nodes as stringsElement.insertbefore (Newnode,node) Inserts a new child node before specifying a child nodeElement.appendchild (newNode) Append child nodes at the endElement.parentnode gets the parent element of the elementmanipulating element stylesA style property can be manipulated directly by the Element.style.proName method. such as: element.style.backgroundcolor= "Grey";Delete element contentElement.removechild (node); D
This article describes in detail how jQuery operates DOM element attributes attr () and removeAtrr (), which are very comprehensive and meticulous. we recommend this article to our friends. How to manipulate element attributes in jQuery:
Attr (): read or write the attribute value of the matching element.
RemoveAttr (): removes the specified attribute from the mat
First Import JS filepageencoding= "UTF-8"%>calling jqueryclass= "CL" > jquery Easyui ID selector class selector tag Selector property selector and Dom object and jQuery conversion between each other
Jquery-based DOM operations
Dom is short for Document Object Model, which means Document Object Model. DOM is an interface unrelated to browsers, platforms, and languages. You can use this interface to easily access all the standard components on the page. DOM operations can
1 What is jquery?jquery is a package of JS, the underlying code is written in the JS code. It encapsulates a lot of methods and properties that we can use directly, without having to worry about how others are implemented, just by learning to call.2 Why study jquery?First, the native JS code has several disadvantages:A: Compatibility issuesB: More repetitive code
This example describes the jquery traversal DOM element and node method. Share to everyone for your reference, specific as follows:
One, up traversal--ancestor element
①$ (selector). parent ([filter]): Returns the direct parent element of a selector matching element, which can accept a filter selector to filter the returned parent element.
②$ (selector). Parents ([filter]): Returns all ancestor nodes of
All along, all kinds of JS best practice will tell us that JS is placed in the end of the HTML, that is /body> , the reason is: JS will block the download, and, in JS is likely to have the operation of the DOM, put in the end of the HTML, as far as possible to ensure that the execution of JS after the completion of the DOM loading. If executed in the OnLoad event, if the page has a lot of images, then the o
This article mainly introduces how to remove events using DOM in JQuery, and involves the unbind method in jQuery to remove event bindings, for more information about how to remove DOM events in JQuery, see the following example. Share it with you for your reference. The det
1. Get the attributes of an elementGets and sets properties using the Attr method of jquery, removing the attribute using the Removeattr method.Syntax: $ (selector). attr (attribute)Here's an example: $ (' img '). attr (' src ')//Get the SRC attribute under the IMG element2. Setting the attributes of an elementSince we can all get the attributes of the element, we will generally operate on the acquired element.Syntax: $ (selector). attr (Attribute,val
1. $ (document). The role of ready is to wait until the nodes in the document of the page are loaded, and then execute the subsequent code, because we may depend on one element of the page when executing the code. We want to make sure that this element is actually loaded before it can be used correctly. $ (document). Ready (function () {content});1.jQuery objects and Dom objectsjquery objects are not the sa
This article mainly describes the information about Jquery and DOM objects. It is very simple and practical. If you need it, refer to the first time learning jquery, we often cannot distinguish between DOM objects and Jquery objects. Next we will briefly discuss the relation
What is a DOM objectUsing the methods in JavaScript to get the elements returned from the page is the DOM object. For example, a DOM object is returned using the Document.getelement* series method. var btn = document.getelementbyid ( "Btnshowdiv"); var divs = document.getelementsbytagname (" div ") dom object
Explanation of mutual conversion between jquery objects and DOM objects, jquerydom
Mutual conversion between jquery objects and DOM objects
Before discussing the mutual conversion between jquery objects and DOM objects, we must fi
Same as remove (), but does not remove the matching elements from the jquery object
Not deleting nodes but emptying all descendant nodes in the element
Post-deletion incidents and data
No
Yes
-
After deletion, the element itself recovers
Yes
Yes
Yes
05. Copying NodesClone ():$ ("ul Li"). Click (function () { $ (this). Clone (). AppendTo ("ul"); Copy the currently click
DOM objects and jQuery objects are very important during operations and are the basis for interaction between jquery and page elements.
What is a DOM object?
HTML organizes documents in a tree structure as follows:
The Code is as follows:
1-4
This article mainly introduces the DOM operation using jQuery (cross-) iframe in the same domain in detail. If you need it, you can refer to it. I hope it will be helpful to you. frame is still quite popular, it is used in many cases. For example, traditional upload, select under ie6, proxy, cross-domain, and so on. Today, we will briefly describe cross-iframe related operations, mainly in the use of
This article mainly introduces the usage of DOM Event bubbling in JQuery. it analyzes the principle of event bubbling and the method to prevent it, for more information about DOM Event bubbling in JQuery, see the examples in this article. Share it with you for your reference. The specific analysis is as follows:
What
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.