JavaScript Adding a new dropdown menu box with a click of a link adding drop down menu in excel,adding drop down menu

Below is a javascript function that adds a new dropdown menu box. It works but when i put a name in select name and value in option value, it will not work.

function add() {
  var ni = document.getElementById('myDiv');
  var numi = document.getElementById('theValue');
  var num = (document.getElementById('theValue').value -1)+ 2;
  numi.value = num;
  var newdiv = document.createElement('div');
  var divIdName = 'my'+num+'Div';
  newdiv.setAttribute('id',divIdName);
  newdiv.innerHTML = "<select> <option> Apple </option> <option> Orange </option> </select>";  
}


What could the problem be? Thank you!

Answer:1

You need to place/append the element to the body too. Here's what you need to add in your function:

document.body.appendChild(newdiv);

Check the output/usage.

Answer:2

Is it possible to have an effect in javascript where the level of water in the transparent bottle increases from 0 in the bottom to a specified amount say 800ml dynamically when user visits the page. ...

Is it possible to have an effect in javascript where the level of water in the transparent bottle increases from 0 in the bottom to a specified amount say 800ml dynamically when user visits the page. ...

Yesterday we identified a problem with one of our sites crashing whenever the iframe on the homepage was hidden, and it was only happening on IE9. The iFrame contained some simple html and a slideshow,...

Yesterday we identified a problem with one of our sites crashing whenever the iframe on the homepage was hidden, and it was only happening on IE9. The iFrame contained some simple html and a slideshow,...

  1. internet explorer crashing windows 10
  2. internet explorer crashing windows 7
  3. internet explorer crashing when trying to print
  4. internet explorer crashing kernelbase.dll
  5. internet explorer crashing on startup
  6. internet explorer crashing when opening pdf
  7. internet explorer crashing on startup windows 10
  8. internet explorer crashing when printing
  9. internet explorer crashing windows 10 1903
  10. internet explorer crashing
  11. internet explorer crashing windows 10 1809
  12. internet explorer crashing when opening
  13. internet explorer crashing on startup windows 7
  14. internet explorer crashing on ebay
  15. internet explorer crashing surface rt
  16. internet explorer crashing when opening outlook 2016
  17. internet explorer crashing windows 8
  18. internet explorer crashing after update
  19. internet explorer crashing randomly
  20. internet explorer crashing when opening outlook

I'm developing a web site using asp.net 2.0 and I recently added a few lines of javascript to save the scroll position of a div across postbacks. The problem is that when the page loads the div's ...

I'm developing a web site using asp.net 2.0 and I recently added a few lines of javascript to save the scroll position of a div across postbacks. The problem is that when the page loads the div's ...

  1. maintaining scroll position when adding content
  2. maintaining scroll position between page loads
  3. maintaining scroll position on postback asp net
  4. retain scroll position after refresh
  5. retain scroll position after postback
  6. retain scroll position on page reload
  7. retain scroll position
  8. retain scroll position after postback jquery
  9. retain scroll position jquery
  10. retain scroll position of div after postback
  11. retain scroll position in angularjs
  12. retain scroll position back
  13. retain scroll position listview
  14. maintaining div scroll position on postback

I am searching for something which renders an HTML template starting from a JSON file of data. The matter is that the plugin/framework/library I'm searching for must create itself the <html> ...

I am searching for something which renders an HTML template starting from a JSON file of data. The matter is that the plugin/framework/library I'm searching for must create itself the <html> ...