How to set value of input using javascsript
<p>i want set value of input type if condition is true but my function not working. i write the correct code but dont know what wrong with it.</p>

<pre><code>&lt;head&gt;
&lt;script type="text/javascript"&gt;
function ghg(){
  var fname= document.getElementById('jitender').value;
  if(fname=="") {
    fname= "i am value";
  }
}
&lt;/script&gt;
&lt;/head&gt;

&lt;body&gt;
  &lt;input type="text" id="jitender" value="" /&gt;
  &lt;input type='button' value="submit" onclick="ghg()"/&gt;
&lt;/body&gt;
</code></pre>
