How to preselect option in select box using jQuery
问题 I have one select box with various options. When a page loads then one option with a value, for example 10, should be preselected with jQuery. How can I do that? 回答1: When the page loads run this (you can put it in <body onload="//put code here"> ): $("option[value='10']").attr('selected','selected'); 回答2: Test the example: http://jsfiddle.net/VArCZ/ $(document).ready(function() { $('#mySelectBox').val('10'); }); Although, jQuery wouldn't be required for this if the intial value will be