I\'m using:
document.querySelectorAll(\'input[value=\"\"]\')
But it\'s not selecting inputs that doesn\'t have the attribute value
Try
document.querySelectorAll('input:not([value])')
This should return all the input
that don't have the value
attribute.
You can use this:
document.querySelectorAll('input:not([value]):not([value=""])');
get all inputs that doesn't have attribute "value" and the attribute "value" is not blank
var test = document.querySelectorAll('input:not([value]):not([value=""])');
for (var i = 0; i < test.length; ++i) {
test[i].style.borderColor = "red";
}
<input type="text" />
<input type="text" value="2" />
<input type="text" />
<input type="text" value="" />
<input type="text" />