Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Don't use html in a variable, much less a script containing html, because it's most difficult to maintenance. do you should use template (<a href="http://handlebarsjs.com/" rel="nofollow">Handlebars</a>, <a href="http://underscorejs.org/" rel="nofollow">undersscore</a>, mustache, ...). good luck!</p> <p>Ex: </p> <pre><code> &lt;html lang="en"&gt; &lt;head&gt; &lt;meta charset="UTF-8"&gt; &lt;script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jquery/1.9.1/jquery.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/handlebars.js/1.0.0-rc.3/handlebars.min.js"&gt;&lt;/script&gt; &lt;title&gt;your title&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;script id="our-tpl" type="text/x-handlebars-template"&gt; &lt;div class="vip" style ="background:url(./uploads/deal{{deal_unique_id}}_1.jpg);"&gt; &lt;span class ="coundtown" value="{{deal_time_off}}" style ="display:none;"&gt;&lt;/span&gt; &lt;div class = "deal_info clearfix"&gt; &lt;div class = "deal_subject clearfix"&gt; &lt;a href="./deal/{{deal_unique_id}}"&gt;adsfd&lt;/a&gt; &lt;/div&gt; &lt;div style = "clear:both"&gt;&lt;/div&gt; &lt;div class="timer"&gt; &lt;img class="img" src="./img/stopwatch.png" border="none" /&gt; &lt;span class ="{{deal_unique_id}}"&gt;&lt;/span&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="percent_mini"&gt;&lt;/div&gt; &lt;/div&gt; &lt;/script&gt; &lt;div class="render"&gt;&lt;/div&gt; &lt;script type="text/javascript"&gt; var obj = {deal_unique_id: 1, deal_time_off: "This is your count"}, tpl = Handlebars.compile(($('#our-tpl').html())), $rend = $('.render'); //render $rend.html(tpl(obj)); $('.vip').ready(function(){ var el = '.'+obj.deal_unique_id; $(el).countdown({ date:obj.deal_time_off}); }); &lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload