Why will focusout(); in jQuery not perform a function after focusing out of a field?
events, focus, jquery
Solution
Since you just seem to care about that field and not the parent/bubbling, use `.blur()`:
$("#employee_id").blur(function(){
if($(this).val() == '') {
$(this).after('<div class="error">Your employee id number is required.</div>');
hasError = true;
}
});
Problem
I am trying to use the focusout(http://api.jquery.com/focusout/) function in jQuery, to perform a function after the user focus away from an input form field, but it's not working. Here is my code: ``` $("#employee_id").focusout(function(){ var employeeId = $("#employee_id").val(); if(employeeId == '') { $("#employee_id").after('<div class="error">Your employee id number is required.</div>'); hasError = true; } }); ``` I am using jquery-1.3.2.min.js since another plugin I am using(qtip) is giving me an error when I try to use jquery-1.4.2.min.js. How can I make the focusout event work, or is there another way to do what I am trying to accomplish?