I am writing this code to count the characters inside the form. Though it works in the sense it’s not actually counting I think. I keep getting the alert that it hasn’t reached it’s minimum count
$(function(){
var minLength = 10;
var form = $('form[action*="post"]');
form.submit(function (e) {
var mini = $('#text_editor_textarea');
if (mini.text().length < minLength) {
alert ('You need to enter at least' +minLength + ' characters');
e.preventDefault();
}
else if (mini.text().length > minLength) {
}
});
});
Now my else if should pass I thought since really it has no restrictions within the statement whats wrong here?
in your code,
miniis the result of.val, which is a string. what you need, is to usemini.lengthupdate: I meant