title: SyntaxError: unterminated string literal <script>...</script> tag not working within a string variable
body: <p>Please look my code.</p>
  
  <pre><code>var id = 1;
  var htmlText = '&lt;div id="horizontalUserPopup"&gt;&lt;ul id="tabs1" class="rtabs"&gt;&lt;/ul&gt;&lt;div class="panel-container"&gt;&lt;div id="view1"&gt;&lt;script&gt;viewMiniProfile("'+id+'",this);&lt;/script&gt;&lt;/div&gt;&lt;div id="view2"&gt;&lt;/div&gt;&lt;div id="view3" style="display:none;"&gt;Blah Blah Blah&lt;/div&gt;&lt;div id="view4" style="display:none;"&gt;444444&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;';
  $('#contents').html(htmlText);
  </code></pre>
  
  <p>Above code i am getting following error - </p>
  
  <p><img src="https://i.stack.imgur.com/BWosB.png" alt="enter image description here"></p>
  
  <p>If i remove <code>&lt;/script&gt;</code> its working fine. Please check and let me know.</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>Complete Code - </p>
  
  <pre><code>function modelInfo(id, username) {
                  var pageUrl = $('#pageurl').val();
                  $('#model-popup-box1 h3').addClass('newsfeed');
                  var content_area = $('#model-popup-content1');
                  content_area.html('Please wait...');
                  $('#model-popup-box-title1').html('About ' + username);
                  $('#model-popup-body1').show();
  
                  content_area.html('&lt;div id="horizontalUserPopup"&gt;&lt;ul id="tabs1" class="rtabs"&gt;&lt;/ul&gt;&lt;div class="panel-container"&gt;&lt;div id="view1"&gt;&lt;script&gt;viewMiniProfile("'+id+'",this);&lt;/script&gt;&lt;/div&gt;&lt;div id="view2"&gt;&lt;/div&gt;&lt;div id="view3" style="display:none;"&gt;Blah Blah Blah&lt;/div&gt;&lt;div id="view4" style="display:none;"&gt;444444&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;');
  
                  var innerHtml = "&lt;li&gt;&lt;a href=\"#view1\" id='miniprofile-view1' onclick=\"viewMiniProfile('"+id+"',this)\"&gt;Mini-Profile&lt;/a&gt;&lt;/li&gt;" +
                          "&lt;li&gt;&lt;a href=\"#view2\"&gt;Tokens&lt;/a&gt;&lt;/li&gt;" +
                          "&lt;li&gt;&lt;a href=\"#view3\"&gt;Notes&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=\"#view4\"&gt;PM Logs&lt;/a&gt;&lt;/li&gt;";
  
                  var ul = document.getElementById("tabs1");
                  ul.innerHTML = innerHtml;
  
  
                  $('#horizontalUserPopup').responsiveTabs({
                      rotate: false,
                      startCollapsed: 'accordion',
                      collapsible: 'accordion',
                      setHash: true,
                      disabled: [4, 5]
                  });
  
              }
  </code></pre>