SHOW:
|
|
- or go back to the newest paste.
| 1 | // Date Format | |
| 2 | var initDatePicker = function () {
| |
| 3 | $( "#input_2_5" ).datepicker({
| |
| 4 | minDate: 1, | |
| 5 | maxDate: "+1m", | |
| 6 | dateFormat: "DD, d MM, yy" | |
| 7 | }); | |
| 8 | ||
| 9 | $("#input_2_5").keypress(function (e) {
| |
| 10 | - | e.preventDefault(); |
| 10 | + | // PreventDefault workaround for older browsers |
| 11 | if (!e.preventDefault) {
| |
| 12 | e.returnValue = false; | |
| 13 | } else {
| |
| 14 | e.preventDefault(); | |
| 15 | } | |
| 16 | }); | |
| 17 | ||
| 18 | $("#input_2_5").keydown(function(e){
| |
| 19 | //If delete or backspace pressed | |
| 20 | if (e.keyCode == 46 || e.keyCode == 8) {
| |
| 21 | $(this).val(''); // Clear text
| |
| 22 | - | e.preventDefault(); |
| 22 | + | |
| 23 | $(this).blur(); // Unfocus from the field | |
| 24 | - | }; |
| 24 | + | |
| 25 | ||
| 26 | - | jQuery(document).bind('gform_post_render', function(){
|
| 26 | + | |
| 27 | - | initDatePicker(); |
| 27 | + | // PreventDefault workaround for older browsers |
| 28 | - | }); |
| 28 | + | if (!e.preventDefault) {
|
| 29 | e.returnValue = false; | |
| 30 | - | initDatePicker(); |
| 30 | + | } else {
|
| 31 | e.preventDefault(); | |
| 32 | } | |
| 33 | }); | |
| 34 | }; |