简体   繁体   中英

date picker js didn't work?

I want to use date picker with js and it's work in some page with some code as same as this page but in this page it didn't work. i wish someone can help me with that

here is my code:

 <link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.6/themes/base/jquery-ui.css" type="text/css" media="all" /> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js" type="text/javascript"></script> <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.6/jquery-ui.min.js" type="text/javascript"></script> <script type="text/javascript"> $(function () { $('#txtDate').datepicker({ dateFormat: 'yy-mm-dd' }).val(); $('#txtDate').datepicker(); }); </script> <script src="http://cdn.jsdelivr.net/webshim/1.12.4/extras/modernizr-custom.js"></script> <!-- polyfiller file to detect and load polyfills --> <script src="http://cdn.jsdelivr.net/webshim/1.12.4/polyfiller.js"></script> 
  <label style="font-size:20px;">期間</label> <form id="form1" runat="server" action="kasrapro.php"> <input type="text" id="txtDate" name= "sdate" /> 

Seems like it was a formatting error. Still there is one error in console that is because of your polyfiller.js , but DatePicker is working now.

 <link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.6/themes/base/jquery-ui.css" type="text/css" media="all" /> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js" type="text/javascript"></script> <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.6/jquery-ui.min.js" type="text/javascript"></script> <script type="text/javascript"> $(function() { $('#txtDate').datepicker({ dateFormat: 'yy-mm-dd' }).val(); $('#txtDate').datepicker(); }); </script> <script src="https://cdn.jsdelivr.net/webshim/1.12.4/extras/modernizr-custom.js"></script> <!-- polyfiller file to detect and load polyfills --> <script src="https://cdn.jsdelivr.net/webshim/1.12.4/polyfiller.js"></script> <label style="font-size:20px;">期間</label> <form id="form1" runat="server" action="kasrapro.php"> <input type="text" id="txtDate" name="sdate" /> </form> 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM