jquery 控制 replaceAll( selector )

replaceAll( selector )

将匹配元素集合替换选中的匹配元素集合中每一个元素。

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
                    "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
  <script src="http://code.jquery.com/jquery-latest.js"></script>
  
  <script>
  $(document).ready(function(){
    $("<b>Paragraph. </b>").replaceAll("p"); // check replaceWith() examples
  });
  </script>
  
</head>
<body>
  <p>Hello</p>
  <p>cruel</p>
  <p>World</p>
</body>
</html>

 

 $("<b>Paragraph. </b>").replaceAll("p"); // check replaceWith() examples
将"<b>Paragraph. </b>"替换匹配p元素集合中每一个p元素

你可能感兴趣的:(html,jquery)