Select inputs that doesn't have value attribute with querySelector

后端 未结 2 1817
走了就别回头了
走了就别回头了 2021-01-21 08:55

I\'m using:

document.querySelectorAll(\'input[value=\"\"]\')

But it\'s not selecting inputs that doesn\'t have the attribute value

2条回答
  •  别那么骄傲
    2021-01-21 09:23

    Try

    document.querySelectorAll('input:not([value])')

    This should return all the input that don't have the value attribute.

提交回复
热议问题