for in option html js code example
Example 1: options in html
<form id="form">
<label for=""></label>
<br>
<input type="" id="">
<br>
<label for=""></label>
<br>
<input list="browsers" name="Thenicknamey" id="Thenickname">
<datalist id="browsers">
<option value=""></option>
<option value=""></option>
<option value=""></option>
</datalist>
<br>
<label for=""></label>
<br>
<input type="" id="">
<br>
<input type="" id="">
</form>
Example 2: javascript option
var s = document.getElementById('s');
var options = [ 'zero', 'one', 'two' ];
options.forEach(function(element, key) {
if (element == 'zero') {
s[s.options.length] = new Option(element, s.options.length, false, false);
}
if (element == 'one') {
s[s.options.length] = new Option(element, s.options.length, true, false);
}
if (element == 'two') {
s[s.options.length] = new Option(element, s.options.length, false, true);
}
});