Answer the question
In order to leave comments, you need to log in
How to prevent the standard text field focus loss handler from being executed in the Materialize CSS framework?
I’m slowly learning the Materialize
CSS framework, and I wanted to implement the following algorithm for text fields (about them in the documentation )
2. If the string length is not equal to 8, then add the invalid class, underlining the field in red.
To receive the text input event in the input, I used the plugin . The code turned out something like this:
$('#login_password').bind('textchange focusout focusin',function(){
var login_password_length = $('#login_password').val().length;
if (login_password_length != 8){
$(this).removeClass("valid");
$(this).addClass("invalid");
}
if (login_password_length == 8){
$(this).removeClass("invalid");
$(this).addClass("valid");
}
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question