单选按钮验证(动态名称)
我有一个单选按钮列表。每个单选按钮都有一个动态名称。 有没有办法检查是否全部被选中? 因为大多数无线电验证脚本使用静态名称。
I have a list of radio buttons. Each radio button has a dynamic name.
Is there a way to check if they are all selected?
Because most radio validation scripts uses a static name.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您知道某个容器的 ID,则可以找到带有“getElementsByTagName”的单选按钮。因此,如果您的 HTML 看起来像这样:
那么您可以检查这样的单选按钮:
如果您使用像 jQuery 这样的框架,您的生活将会变得更加容易。
If you know the id of some container, you can find the radio buttons with "getElementsByTagName". Thus if your HTML looks something like this:
then you could check the radio buttons like this:
Your life would be considerably easier if you were using a framework like jQuery.