Last active
          August 29, 2015 14:00 
        
      - 
      
- 
        Save yblee85/11220380 to your computer and use it in GitHub Desktop. 
    jQuery from 1.9 select option
  
        
  
    
      This file contains hidden or 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
    
  
  
    
  | html | |
| <select id="select_id" value=""> | |
| <option value=""></option> | |
| <option value="VALUE1">Value 1 for display</option> | |
| <option value="VALUE2">Value 2 for display</option> | |
| </select> | |
| js | |
| $("#select_id option[value=VALUE1]").prop('selected', true) | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
            
when you want to get value
$("#select_id :selected").val() -> VALUE1 or VALUE2
$("#select_id :selected").text() -> Value 1 for display or Value 2 for display