JavaScript + CSS + HTML (edit)
HTML
<select id="myselect">
<option value="1">Mr</option>
<option value="2">Mrs</option>
<option value="3">Ms</option>
<option value="4">Dr</option>
<option value="5">Prof</option>
</select>
<p>An ordered list:</p>
<ol>
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ol>
<p>An unordered list:</p>
<ul>
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ul>
JavaScript
$("#myselect option").each(function() { // Add $(this).val() to your list });
Retrieview
$( "#myselect option:selected" ).text();
// => "Mr"
$( "#myselect" ).val();
// => 1
HTML + CSS + JavaScript
JavaScript
(function(){
var ul = document.createElement('ul');
ul.setAttribute('id','proList');
var t, tt;
productList = ['Electronics Watch','House wear Items','Kids wear','Women Fashion'];
document.getElementById('renderList').appendChild(ul);
productList.forEach(renderProductList);
function renderProductList(element, index, arr) {
var li = document.createElement('li');
li.setAttribute('class','item');
ul.appendChild(li);
t = document.createTextNode(element);
li.innerHTML=li.innerHTML + element;
}
})();
CSS
ul#proList{list-style-position: inside}
li.item{list-style:none; padding:5px;}
HTML
<!DOCTYPE html>
<html>
<body>
<div id="renderList"></div>
</body>
</html>
HTML + CSS + JavaScript
<div id="renderList"></div>
<!-- COMMENT -->
ul#proList{list-style-position: inside}
li.item{list-style:none; padding:5px;}
/* COMMENT */
(function(){
var ul = document.createElement('ul');
ul.setAttribute('id','proList');
productList = ['Electronics Watch','House wear Items','Kids wear','Women Fashion'];
document.getElementById('renderList').appendChild(ul);
productList.forEach(renderProductList);
function renderProductList(element, index, arr) {
var li = document.createElement('li');
li.setAttribute('class','item');
ul.appendChild(li);
li.innerHTML=li.innerHTML + element;
// COMMENT
}
})();