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