Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/74.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 事件处理程序不会在Safari中启动_Javascript_Jquery_Twitter Bootstrap_Events_Safari - Fatal编程技术网

Javascript 事件处理程序不会在Safari中启动

Javascript 事件处理程序不会在Safari中启动,javascript,jquery,twitter-bootstrap,events,safari,Javascript,Jquery,Twitter Bootstrap,Events,Safari,我遇到一个仅在Safari浏览器中出现的问题。我的网站是建立在bootstrap3之上的,因此我使用jQuery 代码非常简单,例如: if($('#cadastro')){ //check if there is 'cadastro' page $('.btn-plan-select').click(function(){ //if so, add click event to some buttons $('.btn-plan-select

我遇到一个仅在Safari浏览器中出现的问题。我的网站是建立在bootstrap3之上的,因此我使用jQuery

代码非常简单,例如:

if($('#cadastro')){        //check if there is 'cadastro' page
    $('.btn-plan-select').click(function(){        //if so, add click event to some buttons
        $('.btn-plan-selected').removeClass('btn-plan-selected');
        $(this).addClass('btn-plan-selected');    
        plan = $(this).attr('id');
        $('input#plano').val(plan);        //add some value to a hidden input
    });
}
预期的行为是单击的按钮变为彩色,而上一个选定的按钮变为非彩色。在狩猎中什么也没发生

正如我在这里的一些主题中看到的那样,我试图用一个新的标签来包装我的所有内容,但没有任何改变


上面引用了这些按钮。

如果$'cadastro'{FYI,则该条件始终为真。对我来说,按钮在safari中会上色。@pvg我在safari版本10.0.2中测试过,您的版本是什么?桌面safari 10.1。您可以尝试safari技术预览,看看它是否是一个版本。