JSFiddle - React, Tailwind, and code Playground

HTML

chorme/ ff/sf/op ,use jq1.7 or 1.7.1pre<br/>


<input type="text" class="need" value="test">
<input type="text" class="need" value="">
<br/>

[value=""] not correct:<br/>
<button id="b1">check</button>
<br/>
<button id="b2">clean all input and check </button><br/><br/>


[value=] correct:<br/>
<button id="b3">check ([value=])</button>
<br/>
<button id="b4">clean all input and check </button>
<br/>
<br/>

You can type something to "input" and check again

JavaScript

$(document).ready(function () {
  
    function checkInput(){
      alert($('input[value=""]').length +" input's value is empty!")
    }
    
    
    function checkInput2(){
      alert($('input[value=]').length +" input's value is empty!")
    }    
    
    
    $('#b1').on('click',function(){ checkInput()})
        
    $('#b2').on('click',function(){ 
        $('input').val('');       
        setTimeout(function(){checkInput()},500)
            })        
    
        
    $('#b3').on('click',function(){ checkInput2()})
        
    $('#b4').on('click',function(){ 
        $('input').val('');       
        setTimeout(function(){checkInput2()},500)
            })   
        
})