replace

UK[rɪˈpleɪs] US[rɪˈples]

vt. Replace; replace; put... back in place; (use...) replace

all

English[ɔ:l] American[ɔl]

adj. All; all; various; extreme, as much as possible

pron.all;everything;everyone,everything;all circumstances

adv.entirely;completely;every;very

n.all;[ Often used as A-]whole; [often used with my, your, his, her, etc.] everything that (someone) has

jquery replaceAll() method syntax

Function: replaceAll() method replaces the selected elements with the specified HTML content or elements. replaceAll() has the same effect as replaceWith(). The differences are in syntax: content and selector placement, and replaceWith() being able to use functions for replacement.

Syntax: $(content).replaceAll(selector)

## Parameters:

ParameterDescriptioncontent 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. selectorRequired. Specifies the element to be replaced.

jquery replaceAll() method example

<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>
Run instance »

Click the "Run instance" button to view the online instance

About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!