Adding a select menu item


In the attached example, I am trying a simple test case to populate a select menu item from an array, this works on a html page but not within hype, I’m not sure what I am doing wrong.

Any help is appreciated. (10.9 KB)

var myArray = new Array("1", "2", "3", "4", "5");

// Get dropdown element from DOM
var dropdown = hypeDocument.getElementById('selectNumber');
// Loop through the array
for (var i = 0; i < myArray.length; ++i) {
// Append the element to the end of Array list
el = document.createElement('option');
el.innerText = myArray[i];
el.value = myArray[i];


The following will populate your select element. By the way you must put this in a rectangle not a HTML widget for it to work as you want from a timeline action and Hype function.


Many thanks DBear, that work’s great!