title: Add items to listbox using javascript
body: <p>I am trying to add few items to a list box from a text box  using javascript. but the problem is as soon as I am adding the items, it gets visible in the list box for a second and then gets deleted. Any solution for this?</p>
  
  <p>I am adding items from TextBox4  to ListBox1</p>
  
  <pre><code>function AddToList() {
  
      // Create an Option object        
  
      var opt = document.createElement("option");
  
      // Add an Option object to List Box
  
      document.getElementById("ListBox1").options.add(opt);
      opt.text = document.getElementById("TextBox4").value;
      opt.value = document.getElementById("TextBox4").value;
      document.getElementById("ListBox1").options.add(opt);
  
  
  }
  </code></pre>