【问题标题】:jQuery and radio button validation of groups组的 jQuery 和单选按钮验证
【发布时间】:2011-10-27 13:14:41
【问题描述】:

我希望有人能帮忙解决这个问题。我从jQuery and radio button groups 修改了代码,但无法让它工作。这是我的 HTML:

https://gist.github.com/1319498

这里是 jquery:

https://gist.github.com/1319503

我在 !!$(":radio[name="+group+"]:checked").length) 中的 if 语句失败,并且无论我是否选择单选按钮,都从未将 valid 设置为 true。

【问题讨论】:

    标签: jquery validation radio-group


    【解决方案1】:

    您需要用单引号将选择器修饰符括起来:

    !!$(":radio[name='"+group+"']:checked").length) 
    

    【讨论】:

    • 谢谢!谢谢你!谢谢你!谢谢你!谢谢你!过去 2 天都在这上面度过。有人给 mblase 一些选票(我的代表还不够高)。
    • @Lumbee 好吧,您总是可以接受答案。 meta.stackexchange.com/q/5234/171394
    猜你喜欢
    • 2012-02-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-04-19
    • 2010-09-21
    • 2012-01-04
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多