I have a Date text field and when it is focused a calendar selector pops up underneath is. using jquery I am trying to hide it when the mouse is clicked outside of both the field and the calendar selector itself. This is the code ive got that doesn't seem to work.
With this code, I got to click on the date selector and the calendar disappears. I don't think it is getting the correct position for some reason. It may be because of my css but I cannot change that.
With this code, I got to click on the date selector and the calendar disappears. I don't think it is getting the correct position for some reason. It may be because of my css but I cannot change that.
Any help? Thanks.
hideIfClickOutside: function(event) {
if( event.target == $('.date_input')) {
this.show();
}
if( event.target != $('.date_input') && event.target != $('.date_selector')) {
this.hide();
}
},
...but it doesn't.