The second ‘senzajs’ in the <map> is not being replaced but I would like it to…
Javascript
<script type="text/javascript">
$("document").ready(function(){
$('body').html($('body').html().replace('senzajs', 'js'));
});
</script>
HTML
<div class="objectdiv">
<a href="freegames/Classic/svgsenzajs/start.php/">
<object class="svg" type="image/svg+xml" data="svg/question0optimize1.svg" >
<img src="png/question0optimize1.png" type="image/png" usemap="#mapping"/>
</object>
</a>
<map name="mapping">
<area shape="rect" coords="0,0,1000,1000"
href="freegames/Classic/pngsenzajs/start.php/" />
</map>
</div>
Why is this happening?
Use
.replace(/senzajs/g, 'js'). A regex with thegflag will match all occurrences instead of just the first one.https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String/replace