简体   繁体   English

下拉代码可在Chrome中使用,但不能在Safari中使用?

[英]Dropdown Code works in Chrome but not in Safari?

Anyone know why this dropdown code would be working in Chrome(mac), but not Safari(mac)? 有人知道为什么此下拉代码可以在Chrome(mac)中运行,但不能在Safari(mac)中运行吗?

http://jsfiddle.net/v917ycp6/5/ http://jsfiddle.net/v917ycp6/5/

$(function(){

var $cat = $("#category1"),
    $subcat = $("#category2");

$cat.on("change",function(){
    var _rel = $(this).val();
    $subcat.find("option").attr("style","");
    $subcat.val("");
    if(!_rel) return $subcat.prop("disabled",true);
    $subcat.find("[rel="+_rel+"]").show();
    $subcat.prop("disabled",false);
});

}); });

It seems that Safari's selects doesn't work the same as Chrome, and it doesn't allow to disable options with display: none nor with the hidden attribute, so you will need to remove the option elements from the parent select. 似乎Safari的selects与Chrome的功能不同,它不允许使用display禁用选项:none或hidden属性,因此您需要从父select中删除option元素。 Other option might be to have 3 different selects, one for each category, and what you show / hide are the full selects in this case. 其他选项可能是具有3个不同的选择,每个类别一个,在这种情况下,显示/隐藏的是全部选择。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 导航栏上的下拉菜单不适用于Safari,但适用于Chrome - Dropdown menu on navbar not working in Safari but works in Chrome createElement('canvas')代码适用于Safari,但不适用于Firefox,Chrome - createElement('canvas') code works on Safari but not on Firefox, Chrome JS代码可以在jsbin中工作,而不能在jsfiddle或Chrome / Safari中工作吗? - JS Code Works in jsbin and Not in jsfiddle or Chrome/Safari? JS 代码在 Chrome 中完美运行,但在 Safari 中无法运行 - JS code works perfectly in Chrome but not in Safari VueJS 适用于 chrome 但不适用于 Safari - VueJS works on chrome but not in Safari 滚动效果的Javascript代码可在Safari / chrome中运行,而不在Firefox / Opera中运行 - Javascript code for scroll effect works in Safari/chrome, not firefox/opera 将数据保存到数据库并发送电子邮件的php代码可在chrome上使用,但不能在Safari中使用 - php code that saves data to the database and sends an email works on chrome but not safari 我的“完整日历”代码可在Chrome,Firefox中运行,但是为什么在Safari中却无法使用? - My code for Full Calendar works in Chrome, Firefox but why is this breaking in Safari? Sencha Touch日期代码在Chrome中运行良好,但在Safari上运行失败 - Sencha Touch date code works good in Chrome but fails on Safari 下拉菜单仅适用于Chrome - Dropdown only works in chrome
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM