jquery-processing element content, form elements

Source: Internet
Author: User

working with element content
1. Text method
Instructions for use:
1) non-pass parameters
Get the text content of all elements and their descendants within a jquery object
2) Incoming text content for setting matching elements
3) Incoming function
Use functions to set the text of each element in a jquery object
Two parameters: The first represents the current element ordinal, the second parameter represents the text of the current element
Inside the function this represents the current HTML element object
Returns the content to be set
2. html method
Gets the HTML content of the first matching element or sets the HTML content of the element
Use the same way
Handling table cell elements
1. Val method
Instructions for use:
1) non-pass parameters
Get the value of the first element within a jquery object
2) pass in to set values for all elements within the jquery object
3) Incoming function
Use a function to set the value of each element in a jquery object
Two parameters: The first represents the current element ordinal, the second parameter represents the current value of the current element
Inside the function this represents the current HTML element object
Returns the value to set
associating data with an element
Save some of the elements ' data to the corresponding elements!
Use the Data-property name to store the corresponding attribute inside the element!
jquery also provides a data method that is designed to correlate the elements (storing the data in the corresponding element).
The stored data can be of various types
1. Data method
The value of the data store that stores any related data on the matching element or returns the first element of the matching element collection in the given name
Instructions for use:
1) Save data
Data (Key,value) or data (key-value object)
2) Fetching data
Data (key): Gets the first element of the jquery object that specifies the key
Data (): Gets all the key-value pairs that are associated with the first element in a jquery object
2. Removedata method
removing data
Removedata (key): Removes data from key keys in all elements within a jquery object
Removedata (): Delete all associated data for all elements in a jquery object

jquery-processing element content, form elements

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.