Write a command to change all and in file foohtml to and re
Write a command to change all <B> and </B> in file foo.html to <STRONG> and </STRONG>, respectively.
Solution
ANS:
1) In JQuery we can easily do this,
ex:
$(\'b\').replaceWith(function() {
 return $(\'<strong>\').html($(this).html());
 });
2) By USING JAVASCRIPT
foo.html
<!DOCTYPE html>
 <html>
<head>
 <title>Replacing b with strong</title>
 </head>
<body>
<div id=\"btostrong\">
    Welcome
        <b>Hi</b>
<b> How </b>
<b> Are</b>
<b> You</b>
</div>
<script>
var node = document.getElementById(\"btostrong\")
var search = node.getElementsByTagName(\"b\");
   
 var btag, strongtag;
while (btag = search[0]) {
 strongtag = document.createElement(\"strong\");
while (btag.firstChild) {
 strongtag.appendChild(btag.firstChild);
 }
btag.parentNode.replaceChild(strongtag, btag);
 }
 </script>
 </body>
 </html>

