Select all input tags without a specific attribute in jQuery

How to select all input tags without a specific attribute and verify that each input value is not empty in jQuery

Html

<input type="text" maxlength="255" value="" id="UserName" class="form-error" > <input type="text" maxlength="255" value="" id="Password" class="form-error"> <input type="text" maxlength="255" value="" id="Group" class="form-error" inputname="test" > <input type="text" maxlength="255" value="" id="Aka" class="form-error" inputname="money" > 

I want to select all the inputs from the current page that do not have an attribute like 'inputname'.

Sort of

In javascript

 var inputs = $('input:not(:has(>[inputname]))'); jQuery.each(inputs, function(input) { if (input.value == '') { $(input).next().removeClass('displayNone'); return false; } }); 
+4
source share
3 answers

I believe you want

 var inputs = $('input:not([inputname])'); 

Living example

+4
source

$ ('input: not ([inputname])') should do the trick?

+1
source

Use this var input = $ (": input");

-4
source

Source: https://habr.com/ru/post/1400184/


All Articles