<select id="my_val"> <option value="1">Red</option> <option value="2">Green</option> <option value="3">Blue</option> </select> $(document).on('change', '#my_val', function(e) { e.preventDefault(); var option_val = $("#my_val").val(); //store the dynamic value of select option $( "#my_val" ).find( 'option[value="' + option_val + '"]' ).prop( "selected", true ); //Set select option 'Selected' });
article
Monday, March 24, 2014
How To Dynamically Set Select Option Selected Using Jquery?
How To Dynamically Set Select Option Selected Using Jquery?