jquery replaceWith() method
Translation results:
replace
UK[rɪˈpleɪs] US[rɪˈples]
vt. Replace; replace; put... back in place; (use...) replace
with
英[wɪð] 美[wɪθ]
prep.With; and, with; about; consistent with...
jquery replaceWith() methodsyntax
Function: replaceWith() method replaces the selected element with the specified HTML content or element. replaceWith() has the same effect as replaceAll(). The differences are in the syntax: the content and the position of the selector, and the replaceAll() function cannot be used for replacement.
Syntax: $(selector).replaceWith(content)
##Parameters:
Description | |
Required. Specifies the content to replace the selected element. Possible values: HTML code - e.g. ("<div></div>") New element - e.g. (document.createElement("div")) Existing element - e.g. ($(".div1")) Existing elements will not be moved, only copied and wrapped around the selected element. | |
Required. Specifies the element to be replaced. |
Use function to replace elements: Use function to replace selected elements with new content.
Syntax: $(selector).replaceWith(function())
Parameters:
Description | |
Required. A function that returns the new content to replace the selected element. |