DateBox provides both and open and close callback hook as an option. See the next page for a bit on usage, and the API documents on usage enviroment.

Callback as a reference

The easies method of linking a callback is by reference. For instance:

window.someFunction = function(objA, param1, ...) {
	// Do Something

Then, to link it to datebox, it could be as easy as:

<input type="text" data-role="datebox" data-datebox-mode="calbox" data-datebox-openCallback="someFunction">


<input type="text" data-role="datebox" data-options='{"mode": "calbox", "openCallback": "someFunction"}'>

Callback Arguments

The first argument to any callback function, open or close, is an object of “useful” datebox values. They are:

The second and beyond arguments are the members of the closeCallbackArgs / openCallbackArgs array. When writing functions, it is important to keep in mind that openCallBackArgs[0] === arguments[1].

Although it is not often useful for the object to be returned on openCallback, it still is to provide a consistent prototype between open/close.

Callback Return Values

The return value of closeCallback is not used in any way. It is simply discarded.

If the return value of openCallback is “false” (===), the control will immediatly close again. While it would be likely be preferable to not open the control at all, this concession was made to be able to take advantage of jQM’s built-in “afteropen”/”afterclose”


DateBox also provides a few “global” listeners. They are: