Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript array key value html select

var massiv = [ { "key": 0, "duration": 4, "price": 1000000 },{ "key": 1, "duration": 6, "price": 1250000 },{ "key": 2, "duration": 12, "price": 1500000 }, ];

var elementString = "<select>";
for (var i in massiv) {
  elementString += '<option value="'+massiv[i].duration+'">'+massiv[i].price+'</option>';
}    
elementString += "</select>";

console.log(elementString)
 
PREVIOUS NEXT
Tagged: #javascript #array #key #html #select
ADD COMMENT
Topic
Name
3+7 =