2012-06-20 35 views

Respuesta

7

usando push():

var arr = []; 
$('select').children('option').each(function() { 
    arr.push($(this).html()); 
}); 
2
var arr = []; 
$('select option').html(function(i, html) { 
    arr.push(html); 
}); 

DEMO

0
Array.prototype.fill = function(value, length){ 
    while(length--){ 
     this[length] = value; 
    } 
    return this; 
} 

// example: 
var coords = [].fill(0, 3); 
Cuestiones relacionadas