I have two child inputs within a parent div. I'd like to trigger an event once the user exits the parent element, but not when the user moves from one child directly to the other. In this example I am asking the user to enter the date and time in separate inputs:
<div id="form">
<div id="dateTime">
<input id="date">
<input id="time">
</div>
</div>
I have tried using '.focusout' and '.blur' as follows with no success - by that I mean the event is triggered as the user tabs from "date" to "time" instead of waiting until the user tabs out of "time" and exits the parent "dateTime" div altogether.
$("#form").on('focusout', '#dateTime', function() {
alert ('User has exited the "dateTime" div.');
});
$("#form").on('blur', '#dateTime', function() {
alert ('User has exited the "dateTime" div.');
});
Is the problem with my approach in the HTML structure or use of JQuery?