How to get selected date from calendar control?

Hai

I am creating a custom DatetimePicker control. I just want to know how to get the selected calendar management date (asp.net control) using jQuery. I used this code, but it is wrong.

$(document).ready(function()  {
     $(".UserCalender").click(function () { 

     var a = $('.CalenderDiv:selected').text(); 
     alert(a);        
     });
 });

What happened to this?

+5
source share
1 answer

You cannot do this. None: The selected selector for the anchor tag. It only works for items <option>. What you can do is bind the hanlder event to each ag agent and use the text () method. Sort of

$("#Calendar1 a").click(function(){
   alert ( $(this).text() );
   return false;
});

. , . , .

, datepicker jQuery.

. jQuery UI Datepicker

+4

All Articles