so I'm trying to reverse the order of a select element with multiple values with the following code:
<select multiple="multiple">
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
<option>6</option>
<option>7</option>
<option>8</option>
<option>9</option>
<option>10</option>
</select>
script:
var a = [];
$('option').each(function() {
a.push($(this).val());
});
a.reverse();
for (i = 0; i < a.length; i++) {
$('option').index[i].text(a[i]);
}
and apparently I can't get the index of my option element to set it's value to the reverse order.