📜  jquery select input value empty and hasclass - Javascript代码示例

📅  最后修改于: 2022-03-11 15:03:37.834000             🧑  作者: Mango

代码示例1
$('.check-fields').on('click', function () {

    var reqlength = $('.required-entry').length;
    console.log(reqlength);
    var value = $('.required-entry').filter(function () {
        return this.value != '';
    });

    if (value.length>=0 && (value.length !== reqlength)) {
        alert('Please fill out all required fields.');
    } else {
        alert('Everything has a value.');
    }
});