jQuery replaceAll () method
Examples
The last <p> element with the <span> element:
$("button").click(function(){
$("<span>Hello world!</span>").replaceAll("p:last");
});
$("<span>Hello world!</span>").replaceAll("p:last");
});
try it"
Definition and Usage
replaceAll () method of the selected element is replaced with a new HTML element.
grammar
$(content).replaceAll(selector)
参数 | 描述 |
---|---|
content | 必需。规定要插入的内容(必须包含 HTML 标签)。 |
selector | 必需。规定哪一个元素将被替换。 |