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:
$(".ct").each(function() { $(this).find('X').remove(); });
Where am I going wrong?
Try this:
$(".ct option[value='X']").each(function() { $(this).remove(); });
Or to be more terse, this will work just as well:
$(".ct option[value='X']").remove();
1.4m articles
1.4m replys
5 comments
56.9k users