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