【问题标题】:Need to select an input name with hook inside [duplicate]需要选择一个带有钩子的输入名称[重复]
【发布时间】:2018-08-30 16:27:11
【问题描述】:

我的代码:

document.querySelector('input[name=fos_user_registration_form[gender]]:checked')

由于[性别],它不起作用。

您有选择这种输入类型的想法吗?

【问题讨论】:

  • 发布您正在使用的相关 HTML。

标签: javascript string


【解决方案1】:

引用属性以允许其中包含特殊字符。

document.querySelector('input[name="fos_user_registration_form[gender]"]:checked')

【讨论】:

    猜你喜欢
    • 2015-06-27
    • 1970-01-01
    • 2018-09-14
    • 2021-12-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-07-13
    相关资源
    最近更新 更多