Can't append HTML code into one div by using jQuery
<p>I have one div id=userinfo</p>

<pre><code>&lt;html&gt;
&lt;head&gt;&lt;/head&gt;
&lt;body&gt;
&lt;div id=userinfo&gt;&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>And now I want to append something into this div, depending on the localStorage.</p>

<pre><code>if (localStorage==0){$("#userinfo").append("&lt;p&gt;Test&lt;/p&gt;");} else {$("#userinfo").append("&lt;p&gt;Hello&lt;/p&gt;");}
</code></pre>

<p>But it failed, no matter I input this script into separate JS file or add them into the head of the html file.
I tried exclude this with Google chrome developer tool's console, it works as expected.</p>

<p>I've tried another way round change the script into:</p>

<pre><code>if (localStorage==0){alert("Test");} else {alert("Hello");}
</code></pre>

<p>And add this into JS file, it works!</p>

<p>So, now I'm stacked why my jQuery code not work? </p>
