Home  >  Article  >  Web Front-end  >  jQuery UI Datepicker length is empty or not an object error solution_jquery

jQuery UI Datepicker length is empty or not an object error solution_jquery

WBOY
WBOYOriginal
2016-05-16 18:13:471107browse

When we develop an ASP.NET site, if we use jQuery UI Datepicker in combination with ASP.NET validation controls (such as RequiredFieldValidator):

Copy code The code is as follows:





Then when we select a date in Datepicker, "'length' is empty" will appear or is not an object" error. This is caused by a bug in Datepicker. After my research, I found a very simple solution - capture the onSelect event of Datepicker but do not do any processing:
Copy the code The code is as follows:

$("#<%= txtDate.ClientID %>").datepicker({
onSelect: function( dateText, inst) {
//No processing
}
});

Now when we select a date, "'length' is empty" will not appear or is not an object" error, and the ASP.NET validation control can run as usual.
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn