且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用jQuery循环遍历表单中的所有文本框

更新时间:2023-11-02 23:44:28

$('form input[type="text"]').each(function(){
        // Do your magic here
        if (this.value.match(/\D/)) // regular expression for numbers only.
            Error();
});

如果你有表格ID:

$('#formId input[type="text"]').each(function(){
        // Do your magic here
});