I have a page with 5 selects that all have a class name \'ct\'. I need to remove the option with a value of \'X\' from each select while running an onclick event. My code is
It works on either option tag or text field:
$("#idname option[value='option1']").remove();
$('.ct option').each(function() {
if ( $(this).val() == 'X' ) {
$(this).remove();
}
});
Or just
$('.ct option[value="X"]').remove();
Main point is that find
takes a selector string, by feeding it x
you are looking for elements named x
.