option selected aotu value
$(document).ready( function(){ var theValue = $('#myId').val(); $('option[value=' + theValue + ']') .attr('selected',true); });
Here is what the above code is Doing:
1. When the page loads, it gets the value of the select box.
2. It then finds the option with that value and sets the selected attribute to true.