Click here to Skip to main content
15,895,962 members

Comments by ShortProgrammer (Top 69 by date)

ShortProgrammer 12-Dec-14 9:09am View    
try to implement two posible solution , if you want in Javascript or Jquery .. implement any one from both.
ShortProgrammer 12-Dec-14 9:06am View    
On button click just call this funcion .
$("#addButton").click(function () {

var selectedVal = $('#myDivResultSelect').val();

$('ul').append('<li>'+selectedVal+'</li>')

});


jQuery

var list = $("#selectList");
$.each(items, function(index, item) {
list.append(new Option(item.text, item.value));
});
pure javascript

var list = document.getElementById("selectList");
for(var i in items) {
list.add(new Option(items[i].text, items[i].value));
}
ShortProgrammer 12-Dec-14 8:52am View    
Yeah,wait i let me fix your code ,,
ShortProgrammer 12-Dec-14 7:41am View    
let me know if you can use Jquery .
ShortProgrammer 12-Dec-14 7:40am View    
if you want, you can use Jquery also ??its not issue to use J query??? i can give you solution in both Jquery and javascript but in jquery its would be more easy .