Change the Text of a Option with jQuery
You should start a new question but here's the answer:
$('select option:contains("Newest")').text('TEMPEST');$('select option:contains("Oldest")').text('Newest');$('select option:contains("TEMPEST")').text('Oldest');
$('select option:contains("Newest")').each(function(){ var $this = $(this); $this.text($this.text().replace("Newest","Oldest")); });
EDIT: Answer to the new question:
var $newest = $('select option:contains("Newest")');$('select option:contains("Oldest")').text('Newest');$newest.text('Oldest');
$("#mySelect option").html(function(i,str){ return str.replace(/Newest|Oldest/g, // here give words to replace function(m,n){ return (m == "Newest")?"Oldest":"Newest"; // here give replacement words });});