In the end, my solution was to dynamically connect to the onClose event if the text field in question is used by the dumper (by checking the hasDatepicker class). The problem is that you cannot bind to an event, as usual, since a datepicker can only have one function attached to it by specific events. To get around this, I check if there is already a connected function, and if so call it after my code:
var elem = $(this); var someFunction = function() { //elem.val() != "" } if (elem.hasClass('hasDatepicker')) { var onClose = elem.datepicker('option','onClose'); elem.datepicker('option','onClose', function() { someFunction(); if (onClose) { onClose(elem.val()); } }); } else { elem.bind('blur',someFunction); }
source share