How to use jQuery .replaceAll() to replace each target HTML element with the set of matched HTML elements

1 Answer

0 votes
<!doctype html>
<html>
<head>
  <script src="js/jquery/1.11.3/jquery.min.js"></script>
</head>
<body>

<div class="inner 1">div 1</div>
<div class="inner 2">div 2</div>
<div class="inner 3">div 3</div>
<script>
$( "<h3>Hi</h3>" ).replaceAll( ".inner" );

/*
run:

Hi
Hi
Hi

*/
</script>
</body>
</html>

 



answered Aug 22, 2016 by avibootz
...