Test case for jQuery Ticket 4878

some select val selected stuff

by jitter

HTML

<select id="select">
    <option></option>
    <option>alpha</option>
    <option>beta</option>
    <option>gamma</option>
</select>

JavaScript

var select = $('#select')[0];
for (var i = 0; i < select.options.length; ++i) {
    select.selectedIndex = i;
    $(select).val($(select).val());
    $('body').append(
        '<div>Testing selectedIndex === ' + i + ': ' +
        (select.selectedIndex === i ? 'ok' : 'FAIL [' + select.selectedIndex + ']') +
        '<' + '/div>'
    );
}