option fillde

by nilesh026

HTML

<div><select id="item"></select></div>

JavaScript

clothing=new Array('T shirt black - $23','Sweater black - $34','Hoodie shirt black - $87');

    var len = clothing.length;
    
    for (i=0; i<len; i++) {
           var a = clothing[i].split(" - ");
        $('#item').append('<option value = "'+a[1]+'">'+a[0]+'</option>');
    }