Javascript error: Uncaught TypeError: Cannot read property 'value' of null
<p>I have two questions.<br>
1) I wrote this html tag and created javascript in separate file.</p>

<pre><code>&lt;input type="text" id="callno" value="3333"&gt;
</code></pre>

<p>In the js, I have </p>

<pre><code>var PhoneNumber = document.getElementById("callno").value;
</code></pre>

<p>However, when I look at the console in the browser (Google Chrome) I saw that there is an error <strong>Uncaught TypeError: Cannot read property 'value' of null</strong>. </p>

<p>2) How can I make that each time when I update value of html tag in above the value of PhoneNumber updated automatically.</p>