Javascript 使用prototype js库从html multi-select中删除选项
我想使用prototype从HTML多选框中删除一个选项。我尝试了下面的一个,不幸的是它不起作用Javascript 使用prototype js库从html multi-select中删除选项,javascript,prototypejs,html-select,Javascript,Prototypejs,Html Select,我想使用prototype从HTML多选框中删除一个选项。我尝试了下面的一个,不幸的是它不起作用 $('left').options.item($('left').selectedIndex)).remove(); 我在.removedChild()中找到了一些示例。我不想使用它们,因为它违背了使用类似于JS库的原型的目的。您缺少引号。试试这个 $('left').options.item($('left').selectedIndex).remove(); 你可能会: $('left').
$('left').options.item($('left').selectedIndex)).remove();
我在
.removedChild()
中找到了一些示例。我不想使用它们,因为它违背了使用类似于JS库的原型的目的。您缺少引号。试试这个
$('left').options.item($('left').selectedIndex).remove();
你可能会:
$('left').down(':selected').remove();
或:选中的
或:激活的
或其他东西。我想是吧
编辑否。奇怪的医生
编辑
。选择
。向下
。谢谢@clockworkgeek我发现少了一个括号。正确的代码行是
$('left').options.item($('left').selectedIndex).remove();
用替换
选择请将您的答案标记为正确,这样人们就不会来这里帮助您了