我有一个 JS 代码,它的功能是验证表单,现在我要做的是添加 1 个函数来防止文本框用户名中的空格以及消息,“不允许空格”。到目前为止,这是我的 JS 代码:
$().ready(function()
{
$("#signupForm").validate(
{
rules:
{
full_name: "required",
username: {
required: true,
minlength: 2
},
password: {
required: true,
minlength: 5
},
email: {
required: true,
email: true
},
},
messages:
{
full_name: "Please enter your full name",
username:
{
required: "Please enter a username",
minlength: "Your username must consist of at least 2 characters"
},
password:
{
required: "Please provide a password",
minlength: "Your password must be at least 5 characters long"
},
email: "Please enter a valid email address"
}
});
});
任何人都可以给我的想法?谢谢。