jQueryMobile - DateBox

Home

Public Functions

Datebox has a number of public functions. They are:

Events

Datebox has a few standard init events. They are:

Datebox also has a number of custom callback event types. They all fire the same master event, with an object payload. To catch:

$('element').bind('datebox', function (e, passed) { ... });

To override one of the action causeing methods, something like: (must happen before loading JQM and datebox to work)

$('document').bind('pagecreate', function() {
  $('element').bind('datebox', function(e, p) {
    if ( p.method === 'set' ) {
      e.stopImmediatePropagation()
      //DO SOMETHING//
    }
  });
});

Example code to disable datebox on close:

$('element').bind('datebox', function (e, passed) { 
  if ( passed.method === 'close' ) {
    $('element').datebox('disable');
  }
});

Example to modify and set date without open (increment month by 2):

$('element').trigger('datebox', {'method':'dooffset', 'type':'m', 'amount':2}).trigger('datebox', {'method':'doset'});

Working with callbacks

Callbacks ('openCallback' and 'closeCallback') are simple to work with - a few interesting features:

Fun toys inside the widget for your use: