Skip to main content
line breaks to improve readability (IMHO)
Source Link
nickf
  • 547.8k
  • 199
  • 660
  • 727
$('#mySelect')
    .find('option')
    .remove()
    .end()
    .append('<option value="whatever">text</option>')
    .val('whatever') 
;
$('#mySelect').find('option').remove().end().append('<option value="whatever">text</option>').val('whatever');
$('#mySelect')
    .find('option')
    .remove()
    .end()
    .append('<option value="whatever">text</option>')
    .val('whatever') 
;
Source Link
Matt
  • 32.4k
  • 4
  • 36
  • 33

$('#mySelect').find('option').remove().end().append('<option value="whatever">text</option>').val('whatever');