0

var result = document.getElementById("textbox1");

result.value = salary;
<input id="textbox1" name="texbox1" type="text" >
mkaatman
  • 4,760
  • 1
  • 28
  • 49
  • You haven't defined salary. Maybe you are trying to do the opposite? `var salary = result.value;` – mkaatman Feb 05 '16 at 03:31
  • Because you're trying to access a variable before it is present in the DOM. Either wrap the code in `DOMContentLoaded` callback, or move the ` – Tushar Feb 05 '16 at 03:31
  • the function `var result = document.getElementById("textbox1");` was called before the element `` existed. Call the js after the element was loaded. – Adrian Feb 05 '16 at 03:31
  • Welcome to SO! See [ask] and [mcve] – Tushar Feb 05 '16 at 03:33
  • I have the whole code .But it is too long how can i send it through comment – Aamir Nawab Feb 05 '16 at 03:35
  • @AamirNawab As I said in the previous comment, move the ` – Tushar Feb 05 '16 at 03:38

0 Answers0