How does one create a dropdown list only using JS? Example I have my HTML, I know for dropdown list in HTML you use select and option tags but if I were not to change any HTML elements and only use Javascript and link the html in it to create a Day-Month-Year dropdown using JS, how would that be done?
My HTML:
<!doctype html>
<html lang="en">
<head>
<title> Testing for JS Dropdown</title>
<style>
div {
width: 50%;
margin: auto;
height: 200px;
border: 5px solid black;
background-color: silver;
}
.field {
padding-left: 10px;
width: 60px;
display: inline-block;
}
h2 { padding-left: 10px;}
</style>
<meta charset="utf-8">
<script src="prototype.js"></script>
<script src="JStester.js"></script>
</head>
<body>
<div>
<h2> Select Day-Month-Year </h2>
<p> <span class="field">Day </span><select id="days"> </select></p>
<p> <span class="field">Month</span><select id="months"> </select></p>
<p> <span class="field">Year</span><select id="years"></select></p>
</div>
</body>
</html>