Created
April 6, 2014 15:48
-
-
Save bluehazetech/10007854 to your computer and use it in GitHub Desktop.
JavaScript: Get Selected Option
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Select an option based on index: | |
$('#selectBox option')[index].attr('selected', 'selected'); | |
// Select an option based on value: | |
$('#selectBox option[value=value]').attr('selected', 'selected'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment