Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在选择框中有多个 optgroup,它的某些值是相同的,我想删除特定的 optgroup 值。我如何更改以下代码以明智地删除 optgroup。
$("#selectBox option[value='option1']").remove();
在这种情况下
$('#select optgroup[label="popular"] option[value="1"]').remove()
演示:小提琴