0
<select name="select-your-sporting-event" id="select-your-sporting-event" class="select">
    <option>-------------</option>
    <option>Cricket Packages @ Lords</option>
    <option>Football Packages</option>
    <option>F1 Packages</option>
    <option>Moto GP Packages</option>
    <option>Golf Packages</option>
    <option>Tennis Packages</option>
    <option>Footbal World Cup 2014</option>
</select>
4

1 に答える 1

2
$(function() { // when DOM is ready
    // using 'val' method
    $('#select-your-sporting-event').val('F1 Packages');
    // using 'prop' method
    $('#select-your-sporting-event option:contains(F1 Packages)').prop('selected', true);
    // using 'eq' method
    $('#select-your-sporting-event option').eq(3).prop('selected', true);
})

小道具| |

于 2013-01-07T07:34:56.933 に答える