JQuery datePicker date reset

前端 未结 6 1228
耶瑟儿~
耶瑟儿~ 2020-12-14 20:37

I would like to add a \"Reset\" control to the datepicker at the bottom of the calendar - where the \"close\" control goes. This would enable the user to reset the input tie

6条回答
  •  抹茶落季
    2020-12-14 20:53

    I found a nicer solution:

    $(document).ready(function () {
        $(".datepicker").datepicker({
                showOn: 'focus',
                showButtonPanel: true,
                closeText: 'Clear', // Text to show for "close" button
                onClose: function () {
                    var event = arguments.callee.caller.caller.arguments[0];
                    // If "Clear" gets clicked, then really clear it
                    if ($(event.delegateTarget).hasClass('ui-datepicker-close')) {
                        $(this).val('');
                    }
                }
        });
    });
    

    http://jsfiddle.net/swjw5w7q/1/

提交回复
热议问题