📌  相关文章
📜  jquery中的多个复选框验证 - Javascript代码示例

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

代码示例1
function onSubmit() 
{ 
    var fields = $("input[name='list']").serializeArray(); 
    if (fields.length === 0) 
    { 
        alert('nothing selected'); 
        // cancel submit
        return false;
    } 
    else 
    { 
        alert(fields.length + " items selected"); 
    }
}

// register event on form, not submit button
$('#subscribeForm').submit(onSubmit)

//**************************************************
// HTML
zero
one
two