I have an issue on our checkout, where we are using jQuery to add a class to the input fields, when they aren't empty. The code has worked perfectly for our needs so far. The issue now is, that we are using a small plugin that automatic provides the city name, when the zip code is entered. When this happens, the code does not work and the class is not added to the field, until it is clicked.
I can't seem to find a proper solution for this, so any help is appreciated.
$('.input-text').each(function(){
changeState($(this));
});
$('.input-text').on('focusout', function(){
changeState($(this));
});
function changeState($formControl){
if($formControl.val().length > 0){
$formControl.addClass('has-value');
}
else{
$formControl.removeClass('has-value');
}
}