/ home / customer care

Knowledgebase
You are here: Support > Knowledgebase > Programming

How to Dynamically Add an Element in Dropdown Menu (Javascript)

function AddItem(text, value){
  var opt = document.createElement('option');
  opt.text = text;
  opt.value = value;
  document.getElementById('menu1').options.add(opt);
  opt.selected = true;
}            



Was this answer helpful?

Add to Favourites
Print this Article

Powered by WHMCompleteSolution


Language:
Valid XHTML 1.1 Valid CSS Powered by Apache Powered by MySQL Powered by PHP UTF8 Charset Minimium 800x600 Resolution