Click here to Skip to main content
15,889,931 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a datepicker on my page it is for filter use when i remove the date on lost focus it is assign date again i want if the date is removed then it should be blank
here what i tried
please suggest something its urgent

What I have tried:

<div class="span2 unit">
                                  <label class="label">Date of Birth</label>                         	
                                    <div class="input">                                    
                                        <label class="icon-right" for="singleDatePicker">
                                            class="fa fa-calendar">
                                        </label>
                                        <input class="form-control" id="singleDatePicker" placeholder="Date..." type="text"/>
                                    </div>
                                </div><!--span3-->




$("#singleDatePicker").keyup(function (e) {
    if (e.keyCode == 8 || e.keyCode == 46) {
        $('#singleDatePicker').val('');
       // $.datepicker('setDate', null);
        //$.datepicker._clearDate(this);
    }

});
Posted
Updated 30-Jan-17 17:13pm
v2

1 solution

Check out this Datepicker | jQuery UI[^] and it does not need
keyup
event at all.
 
Share this answer
 
Comments
Member 12966735 30-Jan-17 23:15pm    
Thank you for the solution
It works fine but now the problem is by adding this following block
my pagination is not working may be my jquery version is lower please suggest solution on this

 <script src="https://code.jquery.com/jquery-1.12.4.js"></script>
    <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
Peter Leow 30-Jan-17 23:17pm    
If this is a separate issue, post it as a new question with code snippet so that more eyes can attend to it.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900