jQuery Validate no Hyphens
Hello I am using the jQuery Validation plugin to validate my HTML forms.
I have an input field that does no开发者_C百科t accept hyphens:
<label for="trackISRC"><span class="mandatory">*</span> Track ISRC:</label>
<input type="text" name="trackISRC" id="trackISRC" MAXLENGTH="12">
Now I have to find a way to make this field accept every type of character but NO hyphens using the jQuery validation plugin..
How can I do that?
This is an example of the jQuery validation plugin for rules:
$("#trackFile").rules("add", {
accept: "mp3|WAV|MP3|wav"
});
Thanks!
The regexp for no hyphens:
"^[^\\-]*$"
精彩评论