Jquery selector to find out count of non empty inputs

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

I have the below HTML DOM

      

2条回答
  •  逝去的感伤
    2021-02-19 02:05

    You can pass in a filter function rather than a selector:

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

提交回复
热议问题