jquery remove an change text
by chris callaghan
HTML
<select multiple id ="pa_options">
<option value="3">asdas</option>
<option value="4">Box efdf</option>
<option value="4">Case ad</option>
</select>
<select multiple id ="pa_options">
<option value="3">asdas</option>
<option value="4">Case</option>
</select>
JavaScript
var single = "Single"
var ridgepack = "ridgepack"
var box = "Box"
var ccase = "Case"
jQuery('select#pa_options option:contains('+single+')').remove();
jQuery('select#pa_options option:contains('+ridgepack+')').remove();
jQuery('select#pa_options option:contains('+box+')').text('Box');
jQuery('select#pa_options option:contains('+ccase+')').text('Case');
jQuery('select#pa_options option').each(function() {
if (jQuery(this).not(':selected')) {
jQuery('select#pa_options option:contains('+ccase+')').prop('selected', true);
}
});
jQuery('select#pa_options option:contains('+box+')').prop('selected', true);