How to validate empty textbox with jquery validate method
tshah09 opened this issue · 0 comments
tshah09 commented
Hi,
I am using textext.js in my file.
My textarea name and id is "searchInput".
I want to validate and throw empty div error by using jquery validation.
My jquery validation code is -
$("#createUser").validate({
rules: {
username: {
required: true
},
useremail: {
required: true,
email: true
},
password: {
required: true
},
searchInput: {
required:{
depends : function(element){
console.log($('#searchInput').textext()[0].tags());
}
}
},
userrole: {
valueNotEquals: "0"
}
},
messages: {
username: "Please specify user name",
useremail: "Please specify email",
password: "Please specify password",
searchInput: "Please assign service center",
userrole: "Please specify user role"
},
submitHandler: function(form) {
form.submit();
}
});
Please provide solution