you can use :contains to filter based on text content of an element, but note that it will return partial matches.
So :contains('Vaillant 835')will return :contains('Vaillant 835') and :contains('Vaillant 8356')
jQuery("#select_Boiler option:contains('Vaillant 835')").remove();
If you want to filter for equal you need to do a manual filter like
jQuery("#select_Boiler option").filter(function() { return $.trim($(this).text()) == 'Vaillant 835' }).remove();
本文介绍了如何使用jQuery根据文本内容过滤并移除DOM元素。包括使用contains进行部分匹配及通过手动过滤实现精确匹配的方法。
1779

被折叠的 条评论
为什么被折叠?



