(5) wrapInner(html) wraps the sub-content (including text nodes) of each matching element with an HTML structure Description: Bold each sub-content in all paragraphs HTML code:
Hello
cruel
World
jQuery code: $("p") .wrapInner(""); Result:
Hello
cruel
World
(6) wrapInner(elem) Description: Wrap all paragraphs within Bold each sub-content HTML code:
4. Replacement: Replace some HMTL or DOM element (1) replaceWith(content) Replace all matching elements with the specified HTML or DOM element Description: Replace all paragraph tags with bold tags. HTML code:
Hello
cruel
World
jQuery code: $("p" ).replaceWith("Paragraph. "); Result: Paragraph. Paragraph. < ;b>Paragraph. (2) repalceAll(selector) Replace all elements matched by selector with matching elements. Description: Replace all paragraph tags with bold tags HTML code:
5. Delete: Delete the specified element (1)empty() deletes all child nodes in the matched element set. Description: Delete all paragraph sub-elements (including text nodes) HTML code:
p> (2)remove([expr]) Removes all matching elements from DOM Description: Removes all paragraphs from DOM HTML code:
Hello
how are
you?
jQuery code: $("p").remove(); Result: how are Description: Delete the paragraph with hello class from DOM HTML code:
Hello
how are
you?< ;/p> jQuery code: $("p").remove(".hello"); Result: how are
you?
5. Copy: Clone matching elements (1) Clone() Clone matching DOM elements and select these cloned copies. Description: Clone all b elements (and select those cloned copies), then prepend them to all paragraphs. HTML code: Hello
(2) clone(true) the element and all its event handlers and select these cloned copies
Description: Create a button that can copy itself, and its copy also has Same function. HTML code:
jQuery code: $("button").click(function(){ $(this) .clone(true).insertAfter(this); }); Finally finished. The above content refers to the Jquery1.3 Chinese reference. I hope this article will be helpful to beginners.