Is possible to pass the element to the focusout function in Jquery? I would like to tie all textboxes focusout event in one statement. So my solution would be to make them all the same class and then do something like
$(".class-name").focusout( function() {
//do whatever
});
But I would like to get the value of the element inside the focusout without having to refer to it by its id, so is something like this possible?
$(".class-name").focusout( function(this) {
alert( $(this).val() );
});
Assuming you realize the magical nature ofthis is what you want:focusoutoverblur,You only need to bind one
focusoutto the common parent of the input elements.This is the only reason to usefocusout.You may not realize it but when you do
$(".class-name").focusoutit will just bind to each element individually, which defeats the whole purpose offocusout.