Skip to content

Instantly share code, notes, and snippets.

@softwarespot
Created August 1, 2015 08:01
Show Gist options
  • Save softwarespot/7b69be01fba0ce9e4b97 to your computer and use it in GitHub Desktop.
Save softwarespot/7b69be01fba0ce9e4b97 to your computer and use it in GitHub Desktop.
Append an option element to a select element
// Append an option element to a select element
var $input = $('select');
$('<option/>')
.prop('value', value)
.html(value)
.appendTo($input);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment