开发者

Excluding some form element from jquery validation

i am using a form with several textbox elements which i want to validate and fe开发者_Go百科w which i dont want to, i am using jquery .not() for this but i am not getting the desired result am i making some ayntax error or something here is my code

function validateRegisterClick(){
    var isValid = true;
    // Validate User Information.
    $('input[type=text], input[type=password]').not(':input[id$=txtMob], :input[id$=txtOfficeNo]').each(function () {
            if ($(this).val().length <= 0) {
                $(this).next()
                       .fadeIn('slow')
                       .removeClass()
                       .addClass('failure')
                       .fadeIn('slow')
                       .text("Can't be blank.");
                isValid = false;
            }
});
}

it also includes the txtMob and txtOfficeNo as i am using external javascript file so i am using this syntax --thanks Mac


changing the line in my above code solves the problem:

$('input[type=text], input[type=password]').not(':input[type=text][id$=txtMob], :input[type=text][id$=txtOfficeNo]').each(function ()


Exclude the ids with -

$('input').not('input[id$=txtMob], input[id$=txtOfficeNo]').each(function () {
    alert($(this).attr('id'));
});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜