开发者

jQuery error when reading radio button values in Firefox but not in Safari

开发者 https://www.devze.com 2023-02-21 21:31 出处:网络
I get the following error in Firefox/Firebug but not in Safari. $(\"input[name=\'how_many\']:checked\").val is not a function

I get the following error in Firefox/Firebug but not in Safari.

$("input[name='how_many']:checked").val is not a function

Code follows:

$(document).ready(function(){
    $("#message-form").change(function(){

        var selectedRadio = $("input[name='how_many']:checked开发者_JAVA技巧").val();

        if(selectedRadio == "some")
        {
              $("#conditional").fadeIn("slow");
        }else{
              $("#conditional").fadeOut("slow");
        };        
    });
});


Not sure why this fixed it but I moved my scripts to the bottom in front of and now it's working in Firefox, Chrome and Safari.

0

精彩评论

暂无评论...
验证码 换一张
取 消