Dom operations in jquery

Source: Internet
Author: User

* DOM manipulation in jquery

* Basic Operation

* HTML ()-similar to the native Dom's innerHTML property

* Get-HTML ()

* Settings-HTML (HTML code)

* Val ()-Similar to the native Dom's Value property

* Get-Val ()

* Set-Val (value)

* TEXT ()-similar to the Textcontent property of the native Dom

* Get-text ()

* Settings-text (textual content)

* attr ()-Gets or sets the properties of the specified element

* Get-attr (attrname)-Similar to GetAttribute ()

* Set-attr (Attrname,attrvalue)-Similar to setattribute ()

* REMOVEATTR (Attrname)-Similar to RemoveAttribute ()

* Style action-CSS

* ATTR ("class", Classvalue)-Set

* AddClass ()-Append style

* Removeclass ()-delete style

* No parameter-delete all styles

* Send parameter-delete the specified style

* Toggleclass ()-Toggle Style

* Only one parameter is accepted

* is the switch between no style and the specified style

* Hasclass ()-Judging style

* Determines whether the specified element contains a specified style

* CSS ()-Action style

* Set

* CSS (Name,value)

* CSS (options)

* Options-option

{

Name:value,

Name:value,

...

}

* Get-CSS (name)

* Traversing nodes

* Parent ()-Gets the parent node of the specified node

* Children ()-Gets all child nodes of the specified node

* Next ()-Gets the next sibling node of the specified node

* Prev ()-Gets the previous sibling node of the specified node

* Siblings ()-Gets all sibling nodes of the specified node

* FIND (expr)-finds the specified content in the specified node

* Note-Find the descendant nodes of the specified node

* Create Nodes

* Element node-$ (HTML code)

* Text nodes-text ()

* Attribute node-attr ()

* JQuery-$ (HTML code)

* Delete Node

* Remove ()-delete itself and descendant nodes

* Empty ()-(empty) Delete descendant nodes, but retain their own nodes

* Insert Node

* Internal Insert

* Append

* prepend

* AppendTo

* Prependto

* External Insert

* Before

* After

* InsertBefore

* InsertAfter

* Replace node

* Repalcewith

* ReplaceAll-that's the upside down Repalcewith

* Copy Node

* Jquery-clone (Boolean)

* Boolean parameter-Indicates whether the event is copied

* Dom-clonenode (Boolean)

* Boolean parameter-Indicates whether descendant nodes are copied

* Event

* Ready ()-similar to the role of window.onload

* notation

* $ (document). Ready (function () {});

* $ (). Ready (function () {});

* $ (function () {});

* The difference between ready and onload

* Ready

* with Shorthand method

* Allow multiple in an HTML page

* Wait for all DOM structures in the HTML page to load and execute

* OnLoad

* No Shorthand method

* In an HTML page only one

* You must wait for all content in the HTML page to complete before you can execute

* Event binding and unbinding

* BIND (TYPE,DATA,FN)-bind event

* Type-Specifies the event name of the binding

* If multiple events are bound, use spaces to separate them

* Data-optional, additional data object that is passed to the event object as the value of the Event.data property

* FN-handler function for binding event

* UNBIND ()-Unbind event

* Type-Specifies the name of the event to unbind

* No content is passed by default-unbind all Events

* Specify single event name-Unbind individual events

* Specify multiple event names-Unbind multiple events

* What events are allowed to be specified for binding and unbinding?

Blur, Focus, Focusin, focusout, load, resize, scroll, unload, click, DblClick, MouseDown, MouseUp, MouseMove, MouseOver, M Ouseout, MouseEnter, MouseLeave, change, select, Submit, KeyDown, KeyPress, KeyUp, error.

* Note

* The so-called Click () event is a shorthand for bind (' click ')

* Events Object (event)

* The event object is encapsulated in the parameters of the handler function corresponding to the event

Ele.onclick = function (event) {

Event

}

* Common usage

* pagex/clientx/offsetx/x-current X-axis

* pagey/clienty/offsety/y-Current y-axis

* Target-The source object (element) of the current binding event

* ReturnValue-return value, Boolean type

* Return FALSE-block the default behavior of the page

* Which/keycode/charcode-Keyboard corresponding value

* Event Bubbling

* Capture

* Bubbling

* Simulation Events (Learn)

* Trigger ()

* Event Switching

* Hover (Over,out) method

* Handling function of the Over-onmouseover event

* Handling function of the Out-onmouseout event

* Review Content

* Native DOM bound events three kinds

* Specify event names in HTML page elements

* in JavaScript code

* Element.onclick = function () {}

* Element.addeventlistener ("click", Function () {});

Dom operations in jquery

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.