下面的代码工作正常Firefox
& Chrome
,但它不在IE
中工作。jQuery显示隐藏不适用于Internet Explorer
有人可以让我知道替代隐藏选择Dropdown
选项?
我尝试CSS
风格display: none
以及但不是没有运气。
$j("#id option[value='test']").hide();
下面的代码工作正常Firefox
& Chrome
,但它不在IE
中工作。jQuery显示隐藏不适用于Internet Explorer
有人可以让我知道替代隐藏选择Dropdown
选项?
我尝试CSS
风格display: none
以及但不是没有运气。
$j("#id option[value='test']").hide();
我花了很多时间在谷歌搜索与相同的问题,但改变了我的方法我试过下面的情形的工作就像一个魅力对我来说
$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
以上是从我的方案的例子请拍下看看 希望这会更好的解决所有浏览器的问题
$("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.
同样的事情我使用它在Firefox中工作正常,但不是我IE – magento12345
是的同意。每个浏览器都有不同的渲染引擎。 顺便说一句,而不是document.ready,你可以尝试直接'$(function(){//添加一些代码})' –
你可以请任何例子解释,所以我会更好地理解 – magento12345
$j("#id option[value='test']").hide();
// use proper Id correct.
更换#ID与元件的正确的ID。
OP的代码在'Firefox'和'Chrome'中工作,它不能在'IE'中工作,如果ID是错误的,那么它在任何浏览器中都不起作用。 – Shiladitya
同样的事情我使用它在Firefox中工作正常,但不是我IE – magento12345
好的,你在哪里放置代码在document.ready或清除浏览器缓存并尝试。如果可能的话添加jsfiddle链接。 –
尝试加入下面的cdn有时候会有帮助 – Nithin
whats'$ j'? jQuery? – lscmaro
请提供更多代码(html + jQuery)。这真的很难理解,并检查这一行代码。每个人都只是猜测。我们不知道'#id'是什么以及它来自哪里? –