Skip to content

Instantly share code, notes, and snippets.

@XORwell
Created October 11, 2013 07:50
Show Gist options
  • Save XORwell/6931103 to your computer and use it in GitHub Desktop.
Save XORwell/6931103 to your computer and use it in GitHub Desktop.
filter select input and set the selected value
function set_select_selected(value){
$("#my_field > option").filter(function() {
return $(this).text() == value //the condition
}).prop('selected', true);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment