How do I get the blur from inside the focus?
ontext.focus(function (e) {
var objectThatCausedTheBlur//
});
Unfortunately you cannot access the blur
firing element in the focus
handler event.
However you can have it stored as a global variable:
var $blurLastFiredOn = $();
$el.blur(function() {
$blurLastFiredOn = $(this);
// do stuff
});
$otherEl.focus(function() {
$blurLastFiredOn.doStuff();
});
Or, if you'd prefer to avoid globals, use data
:
$el.blur(function() {
$('body').data('blur-last-fired-on', $(this));
// do stuff
});
$otherEl.focus(function() {
$('body').data('blur-last-fired-on').doStuff();
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.