user123456789 user123456789 - 1 year ago 80
Javascript Question

onblur is getting called before textbox gets updated

I have a textbox for a date so the user can select the date using the datepicker.

enter image description here

I want to know if the date gets changed so I added an

to the textbox:

<asp:TextBox runat="server" ID="txtDate" CssClass="dateonly" Width="80px" onblur="CheckIfDateChanged(this.value)" ></asp:TextBox>

Then in my jquery I wanted to check the date it is getting so I added an alert:

function CheckIfDateChanged(date)

seems to get called before the textbox actually changes with the new date. So if the current date is 28/10/2016 and I change it to 29/10/2016 the alert shows 28/10/2016. Then the date changes after I close the alert message.

How do I know if the date gets changed when they select the new date from the datepicker?

Answer Source

You can use onSelect event.

  onSelect: function(date) {
    display("Date: " + this.value);

Read more

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download