How to wrap a around ® with vanilla JavaScript?

The current jQuery looks like this: jQuery(function($) { $(‘body :not(script,sup)’).contents().filter(function() { return this.nodeType === 3; }).replaceWith(function() { return this.nodeValue.replace(/[®]/g, ‘<sup>$&</sup>’); }); }); Here is the StackOverflow question, I found it: https://stackoverflow.com/a/19364698/8207054 The problem looks like this: I have a text like this: <div>test®</div> but it needs to be modified to this: <div>test<sup>®</sup></div> This needs to…

tic tac toe in jquery can i get this code shorter

I wonder if it possible to make this code shorter in section where function checks if someone won the game i have tried using case break, but i have no idea how makee it work in this example <script> $(document).ready(function(){ if ($(“#item1”).hasClass(“.winnerX”) && $(“#item2”).hasClass(“.winnerX”) && $(“#item3”).hasClass(“.winnerX”)) { $(“.win”).text(“Player X won”); } else if ($(“#item4”).hasClass(“.winnerX”) &&…

For loop append div inside div

Hi I wanted to ask the loop currently in my code I am doing this manually its working manually $( ‘<div id=”demo1″ > <span class=”value”></span> </div><br> Loading’ ).appendTo( $(‘.test’)[0] ); $( ‘<div id=”demo2″> <span class=”value”></span> </div><br> Loading’ ).appendTo( $(‘.test’)[1] ); But I am trying to do it buy function until div id demo10 this is…