replace

英[r??ple?s]

vt. ???; ??... ?? ??? ????;

all

English [?: l] 美[?l ]

adj. n. ??, [?? A-? ???] ?? [my, your, his, her ?? ?? ?? ???] ?? ?

jquery ??All() ??? ???

??: replaceAll() ???? ??? ??? ??? HTML ??? ?? ??? ????. replacementAll()? replacementWith()? ??? ??? ????. ???? ??? ????: ??? ? ??? ??, ??? ??? ?? ??? ??? ? ?? replacementWith().

??: ??$(content).replaceAll(selector)

????:

ParametersDescription
content ?????. ??? ??? ??? ??? ?????. ??? ?: HTML ?? - ?: ("<div></div>") ? ?? - ?: (document.createElement("div")) ?? ?? - ?: ($(".div1")) ???? ?? ??? ?? ???? ?? ? ?????.
????????. ??? ??? ?????.

jquery ??All() ??? ?

<html>
<head>
<script type="text/javascript" src="http://apps.bdimg.com/libs/jquery/2.1.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
  $(".btn1").click(function(){
    $("p").replaceWith("<b>Hello world!</b>");
  });
});
</script>
</head>
<body>
<p>This is a paragraph.</p>
<p>This is another paragraph.</p>
<button class="btn1">用粗體文本替換所有段落</button>
</body>
</html>
???? ?? ?

??? ????? ??? "???? ??" ??? ?????