I am trying to create functionality in a form very similar to what is described in this question. I want to mark the inputs in a form that are incomplete by dynamically adding (or removing) a class. However, in that question, this only updated on blur
. I want the class to be added when the page loads. I currently have:
$(document).ready(function() {
$('.eval-form input').blur(function() {
if( !$(this).val() ) {
$(this).parent().addClass('incomplete-answer');
}
else {
$(this).parent().removeClass('incomplete-answer');
}
});
});
I want to replace .blur
with some method that will proceed to the function when the page loads for the first time. It seems like this should be a simple thing I am trying to do, but my lack of familiarity with jQuery is kicking me and I haven't had any luck with the documentation.