JQuery Update text in a select dropdown list
jquery
Solution
$('#selectid option:eq(NUMERIC_INDEX_GOES_HERE)').text('newtext');
or
$('#selectid').find('option[value="OPTION_VALUE"]').text('newtext');
or
$('#selectid option').filter('[value="OPTION_VALUE"]').text('newtext');
or
$('#selectid option:contains("OLD_TEXT_VALUE")').text('newtext');
Problem
I am trying to update the text of one of the options on a select dropdown after an action on my page. Does anyone know how to do this in jquery? I have tried this: ``` $("#selectid").text("newtext"); ``` But that will remove all of the other options in the select list and it makes it blank. I know this is not the right approach because I just want to update one of the option values. Thanks for the help