You can get the keycode only in keyup or keydown event. if you are using jQuery event.which will hold the keycode
Charcode / Ascii
Charcode/Ascii is available only in keypress event. If you are in keypress event jQuery event.which will hold the ascii value instead of keycode.
You can easily convert the ascii to character with String.fromCharCode method.
Here is the working jsFiddle
Here is the simple way to disable custom holidays in a JQuery UI calendar. Here for example I took may 1, 2, and 3 to disable.
The trick lies in the beforeShowDay event. This event will be triggered before showing each day on calendar. It returns an array of 3 elements.
- true or false : false to disabled date.
- CSS class : A css class to style a particular day
- Tooltip Text : To show the description for a day.
The defaultDate option which I used, just to make sure this code always shows the May, 2012, else the datepicker will show the current month.
Hope you find it helpful.