jquery Basics-Get content and properties

Source: Internet
Author: User

jquery has a way to manipulate HTML elements and attributes.

Get content:

Text ()--Sets or returns the text content of the selected element

HTML ()--Sets or returns the contents of the selected element (including HTML tags)

Val ()--Sets or returns the value of a form field

Get Properties:

The attr () method is used to get the property value

For example:

   1 $("Button"). Click (function(){2 Alert ($ ("#w3s"). attr ("href"));3 });

jquery Documentation Operation Reference Manual

Method Describe

AddClass ()

Adds the specified class name to the matching element.

After ()

Inserts the content after the matched element.

Append () You want to match the end of each element in the element collection by inserting the contents specified by the parameter
AppendTo () Inserts each element in the matching element collection to the end of the target
attr () Sets or returns the attributes and values of a matching element
Before () Insert content before each matching element
Clone () Create a copy of a matching element collection
Detach () Remove a collection of matching elements in the DOM
Empty () Deletes all the child nodes in the matching element collection
Hasclass () Checks whether the matching element owns the specified class
HTML () Sets or returns the HTML content in the collection of matching elements
InsertAfter () Inserts a matching element into the back of another specified collection of elements
InsertBefore () Inserts a matching element in front of another specified collection of elements
Prepend () Inserts parameter-formulated content to the beginning of each element in a matching element collection
Prependto () Inserts each element in the matching element collection to the beginning of the target
Remove () Remove all matching elements
Removeattr () Removes the specified property from all matching elements
Removeclass () Remove all or the specified class from all matching elements
ReplaceAll () Replace all matching elements with matching elements
ReplaceWith () Replace matching elements with new content
Text () Sets or returns the contents of a matching element
Toggleclass () To add or remove a class from a matching element
Unwrap () Removes and replaces the parent element of the specified element
Val () Sets or returns the value of a matching element
Wrap () To wrap a matching element with a specified content or element.
Wrapall () Wrap all matching elements with specified content or elements.
Wrapinner () Wraps the child content of each matched element with the specified content or elements.

jquery Basics-Get content and properties

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.