Easy way to add drop down menu with 1 - 100 without doing 100 different options using javascript?

I was just wondering if there was a simple shortcut to add options to a dropdown menu for the numbers 1 to 100 instead of having to do the following:

<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>

In HTML, no. You’ll need to use JavaScript to do that!

yes sorry I forgot to write javascript

You could use a loop to generate the options as a string and then assign the string to the innerHTML property of the DOM element containing the select element.

so, something like this?

selectMenu = document.getElementById("select");  //your select input

for (let i = 0; i < 100; i++) {
const tempOption = createElement("option");

const tempText = createTextNode[i] ;

tempOption.setAttribute("value", [i]);



<!DOCTYPE html>
var sel = document.createElement("select");
sel[0] = new Option( 'please select option', 0);
for(var i = 1;i<101;i++){
	sel[i] = new Option( i,i);	

Assuming you have a select element with id="select", the following was what I was saying:

const selectMenu = document.getElementById('select');
const options = new Array(100)
  .reduce((html,_,i) => html += `<option value=${i+1}>${i+1}</option>`, '');
selectMenu.innerHTML = options;