I cannot seem to find it. Thanks!
Example:
$(\"#MySelect\").append(new Option(\"MyOption\", \"MyOption\", true, true));
The Mozilla Dev Center is the de facto standard documentation site for all things JavaScript.
option
element reference:Since you're using jQuery, however, there's a better way to construct elements.
$('#MySelect').append('',
{
text: 'MyOption',
value: 'MyOption',
selected: true
})
I'm not sure what the last true
argument should do - at least in Chrome, new Option('text', 'value', true, true)
seems to return the same thing as new Option('text', 'value', true)
.