开发者

Jquery validation issue - not working for one particular field

开发者 https://www.devze.com 2023-03-07 17:39 出处:网络
Ive been looking at this for hours and I figure I\'ll ask here before pulling my hair out. I am doing a form validation. all is well except ONE field: Im sure it is something stupid.

Ive been looking at this for hours and I figure I'll ask here before pulling my hair out. I am doing a form validation. all is well except ONE field: Im sure it is something stupid.

<input name="Credit Card Number" style="width:150px;" title="Credit Card Number" id="billing开发者_如何学PythonCC" type="text" class="textboxpg2" maxlength="50" autocomplete="off" onKeyUp="highlightCC(this.value);">

here is the deal. when I just add the required class it works just fine. when I try to add the rule instead, it doesnt find the field invalid. everything else in the form, all other validations, work fine. just this one. I have tried it without the onkeyup javascript to make sure that it wasn't interfering, and its not the issue. please please point out the stupid error i am sure i am making. I am not getting anything in error console, and aside from that the form validates fine. THANKS!

The rule

        billingCC: {
        required:true,
        creditcard:true,
        number: true,           
    },

the message

billingCC: "Invalid credit card number",


The validate plugin uses the name attribute, not the id, so it's not finding it. Try this:

<input name="billingCC" style="width:150px;" title="Credit Card Number" id="billingCC" type="text" class="textboxpg2" maxlength="50" autocomplete="off" onKeyUp="highlightCC(this.value);">
0

精彩评论

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