It's a shortcut for element creation.
Like you can do $('body').append('<div />')
$('<div />') gives you a <div> which is not in the DOM yet
You can see that both jQuery objects with the divs ($date1 and $date2)
end up appended to #multimonth.
On Jan 20, 8:36 am, divsystem <[email protected]> wrote:
> $date1 = $('<div />')
>
> http://www.kelvinluck.com/assets/jquery/datePicker/v2/demo/datePicker...
>
> $date1 = $('<div />')
> .datePicker({inline:true})
> .bind(
> 'dpMonthChanged',
> function(event, displayedMonth, displayedYear)
> {
> $date2.dpSetDisplayedMonth(displayedMonth+1,
> displayedYear);
> }
> )
> .bind(
> 'dateSelected',
> function(event, date, $td, status)
> {
> $date2.dpSetSelected(date.asString(), status,
> false);
> }
> );
> // remove the "forward" navigation from the first date picker
> $('.dp-nav-next', $date1).html('');
> // create the right hand datePicker and add the relevant event
> listeners to sync it to the left hand one...
> $date2 = $('<div />')
> .datePicker({inline:true})
> .bind(
> 'dpMonthChanged',
> function(event, displayedMonth, displayedYear)
> {
> $date1.dpSetDisplayedMonth(displayedMonth-1,
> displayedYear);
> }
> )
> .bind(
> 'dateSelected',
> function(event, date, $td, status)
> {
> $date1.dpSetSelected(date.asString(), status,
> false);
> }
> );
> // remove the "backward" navigation from the first date picker
> $('.dp-nav-prev', $date2).html('');
> // initialise the date pickers to consecutive months ($date1 defaults
> to this month so set $date2 to next month)
> var now = new Date();
> $date2.dpSetDisplayedMonth(now.getMonth()+1, now.getFullYear());
> // add the generated combined plugin to the document
> $('#multimonth').html('').append($date1, $date2);