views:

78

answers:

1

I am using this jQuery validation library on my website. It requires me to put the validation rules in the class part of the input tag. ie <input class="validate[required,custom[onlyLetter],length[0,100]]" name="firstname" type="text" />

Now this causes me to end up with code in mine that looks similar such as:

<input type="text" 
       id="charfname" 
       name="charfname" 
       value=""  
       style="width: 300px;" 
       class="validate[required,length[3,20],custom[noSpecialCaracters]]" />

Which as you see has a [ and ] in the class name. So when I run the page through a validator I get the error:

character "[" is not allowed in the value of attribute "class"

How do I fix this to make it valid but still have the library work?

Thanks

+1  A: 

Use some other method for initialization or use another script? Use an alternate attribute and a custom DTD for example. Or throw away the attribute based init system and use something else. Either way you have to modify the plugin's code. You cannot use "[" and "]" characters in a class name and any other combination implying them, period.

BYK