Jquery selector to find out count of non empty inputs

前端 未结 2 639
粉色の甜心
粉色の甜心 2021-02-19 01:42

I have the below HTML DOM

      

2条回答
  •  甜味超标
    2021-02-19 02:22

    The attribute value will always be the default value so you must filter through the input boxes and check the value like this code below

    $('#container input[type="text"]').filter(function () {
        return this.value.length > 0
    }).length;
    

    DEMO

提交回复
热议问题