I have a form that is validated by the jQuery validation plugin. The form contains one field (articleTitle) and a submit button. The articleTitle field is where the user can enter a title and then submit. Here are the requirements:
$(".article_form").validate({
errorElement: 'div',
rules: {
articleTitle: {
required: true,
minlength: 10
},
},
messages: {
articleTitle: {
required: "You have to provide a title for your article!",
minlength: "Your title must be at least 10 characters long"
},
},
});
This validation is working, but when the user enters 10 spaces it is thinking it's valid. When in reality, if the user enters 10 spaces it should be considered blank still. How can I make it so that if the user enters only spaces it will be considered blank and tell the user that this field is required?
Notice: The field may contain spaces. Just not the all spaces.