下面的代码在Firefox
和Chrome
中运行良好,但在IE
中不起作用。
谁能让我知道隐藏选择Dropdown
选项的替代方法?
我也尝试过CSS
风格的display: none
,但不怎么走运。
$j("#id option[value='test']").hide();
发布于 2017-09-07 09:44:42
我花了很多时间在谷歌上搜索同样的问题,但我改变了我的方法,我尝试了下面的方案,它对我来说很有吸引力
$j("#shipping_method optgroup[label='Free Shipping']").clone("optgroup[label='Free Shipping']").insertAfter("#shipping_method_form");
$j("#shipping_method optgroup[label='Free Shipping']").remove();
$j(".box-content .fedex").appendTo("#shipping_method");
#shipping_method_form is my select box id
上面是我的场景中的一个例子,请看一看,希望这将是所有浏览器的更好的解决方案
发布于 2017-08-24 05:01:23
$j("#id option[value='test']").hide();
// use proper Id correct.
将#id替换为元素的正确id。
发布于 2017-08-24 05:00:03
$("option[value='test']").hide(); // here I assuming that you are not using ID
$("#idName option[value='test']").hide(); // here I assuming that you are using ID and replace `idName` with your IDs.
https://stackoverflow.com/questions/45853239
复制相似问题