开发者

jQuery Validate no Hyphens

开发者 https://www.devze.com 2023-04-02 21:52 出处:网络
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:

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:

"^[^\\-]*$"
0

精彩评论

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