Note that there are some explanatory texts on larger screens.

plurals
  1. POpure.js must work with the existing page nodes?
    text
    copied!<pre><code>&lt;html lang="en"&gt; &lt;head&gt; &lt;meta charset="utf-8"&gt; &lt;script type='text/javascript' src="js/jquery/jquery-min.js"&gt;&lt;/script&gt; &lt;script type='text/javascript' src="js/pure/pure.js"&gt;&lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div class='result'&gt;Test Page&lt;/div&gt; &lt;script type='text/javascript'&gt; $(document).ready(function(){ var p; p = $("&lt;div&gt;&lt;ul&gt;&lt;li&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;"); directives = {"li": "error"}; data = {"error": "name must be between 3 and 250 characters long"}; p.render(data, directives); $(".result").after(p); }); &lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>The above codes don't insert data into p object.But the following works,</p> <pre><code>&lt;html lang="en"&gt; &lt;head&gt; &lt;meta charset="utf-8"&gt; &lt;script type='text/javascript' src="js/jquery/jquery-min.js"&gt;&lt;/script&gt; &lt;script type='text/javascript' src="js/pure/pure.js"&gt;&lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div class='result'&gt;Test Page&lt;/div&gt; &lt;script type='text/javascript'&gt; $(document).ready(function(){ var p; p = $("&lt;div&gt;&lt;ul&gt;&lt;li&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;"); $(".result").after(p); directives = {"li": "error"}; data = {"error": "name must be between 3 and 250 characters long"}; p.render(data, directives); }); &lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>It seems to insert data, the jquery object(here,it is p)must manipulate the existing html tags? It is not reasonable like the latter,i want the first codes to insert data,but how? Thanks, :)</p>
 

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