How can I change the text of an option with jQuery?
I\'d like to change Newest with Oldest in an option is a element.
$(\
$('select option:contains("Newest")').each(function(){
var $this = $(this);
$this.text($this.text().replace("Newest","Oldest"));
});
http://jsfiddle.net/eSa5p/
EDIT: Answer to the new question:
var $newest = $('select option:contains("Newest")');
$('select option:contains("Oldest")').text('Newest');
$newest.text('Oldest');
http://jsfiddle.net/eSa5p/3/