title: JavaScript remove double brackets (with inner text) from HTML block element
body: <p>I want to remove substrings like <code>[[any content here]]</code> (double-bracked text with brackets) from HTML block element.</p>
  
  <p>When I use this, it works:</p>
  
  <p><code>$('#comment-263353 .ticket-comment-body').html('Replaced with this text successfully!');</code></p>
  
  <p>But when I try to replace my needed substring:</p>
  
  <p><code>$('#comment-263353 .ticket-comment-body').html($('#'+com_id+' .ticket-comment-body').html().replace(/\[\[.*?\]\]/g, ''));</code></p>
  
  <p>, it not works. Why?</p>
  
  <p>Full outer HTML:</p>
  
  <pre><code>&lt;li class="ticket-comment" id="comment-263353" data-parent="263338" data-newparent="263338" data-id="263353" xmlns:v="http://rdf.data-vocabulary.org/#" typeof="v:Review"&gt;
      &lt;!--ID: 263353--&gt;
      &lt;span class="hidden" property="v:itemreviewed"&gt;&lt;/span&gt;
      &lt;div class="ticket-comment-body"&gt;
          &lt;div class="ticket-comment-header"&gt;
              &lt;div class="ticket-comment-dot-wrapper"&gt;&lt;div class="ticket-comment-dot"&gt;&lt;/div&gt;&lt;/div&gt;
              &lt;span class="ticket-comment-author" property="v:reviewer"&gt;admin&lt;/span&gt;
              &lt;span class="ticket-comment-createdon" property="v:dtreviewed" content=""&gt;Just now&lt;/span&gt;
              &lt;span class="ticket-comment-star active"&gt;&lt;i class="glyphicon glyphicon-star unstared star"&gt;&lt;/i&gt;&lt;/span&gt;
              &lt;span class="ticket-comment-up"&gt;&lt;a href="http://beta.mirparfuma.com/vopros-otvet#comment-263338" data-id="263353" data-parent="263338"&gt;↑&lt;/a&gt;&lt;/span&gt;
              &lt;span class="ticket-comment-down"&gt;&lt;a href="#" data-child=""&gt;↓&lt;/a&gt;&lt;/span&gt;
          &lt;/div&gt;
          &lt;div class="ticket-comment-text" property="v:description"&gt;
              Any text
          &lt;/div&gt;
  [[*id:isnot='47304':then='
  &lt;p class="rating"&gt;Rate:
  &lt;span property="v:rating" class="star hidden"&gt;5&lt;/span&gt;
  &lt;span class="star icon_star star_active"&gt;&lt;/span&gt;&lt;span class="star icon_star star_active"&gt;&lt;/span&gt;&lt;span class="star icon_star star_active"&gt;&lt;/span&gt;&lt;span class="star icon_star star_active"&gt;&lt;/span&gt;&lt;span class="star icon_star star_active"&gt;&lt;/span&gt;
  &lt;/p&gt;
  ']]
      &lt;/div&gt;
      &lt;div class="comment-reply"&gt;
          &lt;a href="#" class="reply"&gt;Reply&lt;/a&gt;
          &lt;a href="#" class="edit btn btn-default btn-xs"&gt;Edit&lt;/a&gt;
      &lt;/div&gt;
      &lt;ol class="comments-list"&gt;&lt;/ol&gt;
  &lt;/li&gt;
  </code></pre>