The following lists of methods used to manipulate the HTML.
The " html() " method sets or returns the content (innerHTML) of the selected elements.
When this method is used to return content, it returns the content of the FIRST matched element.
When this method is used to set content, it overwrites the content of ALL matched elements.
The " append() " method inserts specified content at the end of the selected elements.
Note:The " prepend() " method inserts specified content at the beginning of the selected elements.
Note:Inserts content after element
Note:Inserts content before element
Note:This is div for html manipulation
The " text() " Sets or returns the text content of selected elements.
When this method is used to return the text content, it returns the text content of selected elements.
When this method is used to set the text content, it sets the text content of selected elements.
This is some bold text in a paragraph.
This is some bold text in a paragraph.
The " val() " Sets or returns the value of form fields.
When this method is used to return the value, it returns the value of selected elements.
When this method is used to set the value, it sets the value of selected elements.
The " attr() " method sets or returns attributes and values of the selected elements.
When this method is used to return the attribute value, it returns the value of the FIRST matched element.
When this method is used to set attribute values, it sets one or more attribute/value pairs for the set of matched elements.
Get the value of a property for the first element in the set of matched elements or set one or more properties for every matched element.
The " remove() " method removes the selected element(s) and its child elements.
This is some text in the div.This is a paragraph in the div.
This is another paragraph in the div.
This is a paragraph in the div.
This is another paragraph in the div.
The " empty() " method removes the child elements of the selected element(s).
This is some text in the div.This is a paragraph in the div.
This is another paragraph in the div.
This is a paragraph in the div.
This is another paragraph in the div.
The " css() " method to set a specified CSS property,.
This is a heading
This is a paragraph.
This is a paragraph.
The " addClass() " method adds one or more class names to the selected elements.
This method does not remove existing class attributes, it only adds one or more class names to the class attribute.
This is another paragraph.
This is another paragraph.
The " removeClass() " method removes one or more class names from the selected elements.
Note:This is another paragraph.
This is another paragraph.
The " removeAttr() " method Remove an attribute from each element in the set of matched elements.
Note:This is another paragraph.
This is another paragraph.
The " position() " method returns the position (relative to its parent element) of the first matched element.
This method returns an object with 2 properties; the top and left positions in pixels.
This is a paragraph.
This is a paragraph.
The " each() " method iterate over a jQuery object, executing a function for each matched element.
This is a paragraph 0.
This is a paragraph 1.
This is a paragraph 2.
This is a paragraph 0.
This is a paragraph 1.
This is a paragraph 2.
The " eq() " method reduce the set of matched elements to the one at the specified index.
This is a paragraph 0.
This is a paragraph 1.
This is a paragraph 2.
This is a paragraph 0.
This is a paragraph 1.
This is a paragraph 2.
The " is() " method Check the current matched set of elements against a selector, element, or jQuery object and return true if at least one of these elements matches the given arguments.
The " first() " method constructs a new jQuery object from the first element in that set.
This is first paragraph.
This is second paragraph .
This is third paragraph .
This is first paragraph.
This is second paragraph .
This is third paragraph .
The " last() " method constructs a new jQuery object from the last element in that set.
This is first paragraph.
This is second paragraph .
This is third paragraph .
This is first paragraph.
This is second paragraph .
This is third paragraph .
" Length " returns number of elements in the jQuery object.
This is first paragraph.
This is second paragraph .
This is third paragraph .
This is first paragraph.
This is second paragraph .
This is third paragraph .
The " .isNumeric() " method Determines whether its argument is a number.
The " on() " method attaches one or more event handlers for selected elements, and specifies a function to run when the event occurs.There was an another method called " .live() " for doing the same , but in jquery 1.9 thats now removed.
Note:Click me!
Click me!
The " next() " method Get the immediately following sibling of each element in the set of matched elements. If a selector is provided, it retrieves the next sibling only if it matches that selector..
Note:The " prev() " method Get the immediately preceding sibling of each element in the set of matched elements, optionally filtered by a selector.
Note:The " not() " method remove elements from the set of matched elements.
Note:First paragraph
Second paragraph having id : prgh_id
Third paragraph
First paragraph
Second paragraph having id : prgh_id
Third paragraph
The " parent() " method Get the parent of each element in the current set of matched elements, optionally filtered by a selector.
Note:Hello
Hello Again
Hello
Hello Again
The " submit() " method triggers the submit event, or attaches a function to run when a submit event occurs.
Note:The " find() " method Get the descendants of each element in the current set of matched elements, filtered by a selector, jQuery object, or element.
Note:Hello, how are you?
Me? I'm good.
Hello, how are you?
Me? I'm good.
The " insertAfter() " method inserts HTML elements after the selected elements.
Note:Existing content
This is a paragraph.
This is another paragraph.
Existing content
This is a paragraph.
This is another paragraph.
The " insertBefore() " method inserts HTML elements before the selected elements.
Note:Existing content
This is a paragraph.
This is another paragraph.
Existing content
This is a paragraph.
This is another paragraph.
The " parseJSON() " Takes a well-formed JSON string and returns the resulting JavaScript object.
Note:The " JSON.stringify() " Converts a JavaScript value to a JavaScript Object Notation (JSON) string.
Note:After editing Click here: |
Output:
|