Replacing this() with a new value in JavaScript
<p>I'm iterating through every element of a class, and I'm replacing all ** with <strong>bold</strong> tags. </p>

<p>However, it isn't outputting as I want. I used window alerts, and checked, and the regex is converting it correctly, however the <code>$(this).html = txt</code> doesn't seem to be working. I've tried using <code>innerHTML</code>, val. Nothing seems to work.  </p>

<p>The code commented out does work, however I can't refer to all of the Id's because it's possible for new ones to be added, hence me iterating through each element of the class. </p>

<pre class="lang-js prettyprint-override"><code>    $(document).ready(function () {
    setTimeout(function(){
        var bold = /\*\*(\S(.*?\S)?)\*\*/gm;
        $(".grid-text").each(function() {
            var currentElement = $(this).html();
            var txt = currentElement.replace(bold, '&lt;strong&gt;$1&lt;/strong&gt;');
            $(this).html= txt;
        });
        // var s = document.getElementById("001_1_1").innerHTML;
        // var txt = s.replace(bold, '&lt;strong&gt;$1&lt;/strong&gt;');
        // document.getElementById("001_1_1").innerHTML = txt;
    }, 3000);
});
</code></pre>