Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Jun 2006
    Location
    UK
    Posts
    911
    Thanks
    302
    Thanked 2 Times in 2 Posts

    Question Multiple Dates Picker for jQuery UI

    http://dubrox.blogspot.com/2010/09/m...jquery-ui.html

    Hi

    Does anyone know how to make a callback and know which dates are selected for the following example?

    Code:
    // avoid-dates
    
    		$('#avoid-dates').multiDatesPicker({
    
    			addAvoidedDates: ['10/1/2010', '11/2/2010', '12/3/2010', '01/4/2011']
    			
    
    		});

    Thanks

  • #2
    Senior Coder
    Join Date
    Feb 2009
    Location
    Ilkley, West Yorkshire, UK
    Posts
    2,950
    Thanks
    9
    Thanked 724 Times in 718 Posts
    Since this is an extension to jQuery UI datepicker you should be able to use the standard options and events:

    Code:
    $(function() {
            $( "#avoid-dates" ).multiDatesPicker({
                onSelect: function(dateText,inst){alert (dateText);}
                });
                
    })

    does alert the selected date as expected, however, when I try it it no longer seems to accept the dateFormat option. I'm not quite sure where your addAvoidedDates option's coming from either.

  • #3
    Regular Coder
    Join Date
    Jun 2006
    Location
    UK
    Posts
    911
    Thanks
    302
    Thanked 2 Times in 2 Posts
    Hi

    Your code works but alerts only the clicked date.

    I think I found a solution

    Code:
    $('#show_dates').click(function(e) {
    		      e.preventDefault();
    		      var dates = $('#datepicker').multiDatesPicker('getDates');
    		      var dates_in_string = '';
    		      for(d in dates) dates_in_string+= dates[d]+', ';
    		      alert(dates_in_string);
    		});
    Code:
    <input type="button" id="show_dates">

    Thanks for your kind help


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •