简体   繁体   English

jQuery 代码在 chrome 和 safari 中不起作用

[英]jQuery Code not working in chrome and safari

I have following code which shows couple radio buttons on click.我有以下代码,它在点击时显示几个单选按钮。 This works fine in ie and firefox but does not work in chrome or safari even though the alert works.这在 ie 和 firefox 中工作正常,但在 chrome 或 safari 中不起作用,即使警报有效。

function toggle_question_types(){
        if(jQuery('input[name="question"]:checked').val()==1){              
                        jQuery("#abc").show();
                        alert('this works');
                }       
    }    
    toggle_question_types();
    jQuery('input[name="question"]').change(function(){
        toggle_question_types();
    });

forgot to put the } before toggle_question_types();忘记把 } 放在 toggle_question_types() 之前; but this also not working still.但这也不起作用。

You never closed the function definition (insert a } before the explicit call to toggle_question_types ), so I'm not entirely sure how it works in any browsers without infinitely recursing.您从未关闭 function 定义(在显式调用toggle_question_types之前插入} ),所以我不完全确定它在没有无限递归的情况下如何在任何浏览器中工作。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM