html - jQuery datepicker doesn't work in a page -
i'm trying use jquery datepicker (the 1 showed here https://jqueryui.com/datepicker/#default) in page. doesn't work! when click on textbox, calendar showed.
this code of page:
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="http://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css"> <link rel="stylesheet" href="http://jqueryui.com/resources/demos/style.css"> <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> <script> $( function() { $( "#datepicker" ).datepicker(); } ); </script> <title>dashboard</title> <!-- bootstrap core css --> <link href="css/bootstrap.min.css" rel="stylesheet"> <!-- metismenu css --> <link href="css/metismenu.min.css" rel="stylesheet"> <!-- timeline css --> <link href="css/timeline.css" rel="stylesheet"> <!-- custom css --> <link href="css/startmin.css" rel="stylesheet"> <!-- morris charts css --> <link href="css/morris.css" rel="stylesheet"> <!-- custom fonts --> <link href="css/font-awesome.min.css" rel="stylesheet" type="text/css"> </head> <body> <!-- page content --> <div id="page-wrapper"> <div class="container-fluid"> <div class="row"> <div class="col-lg-12"> <h1 class="page-header">reports e stampe</h1> </div> </div> <form method="post" action="page1.php" target="_blank"> <p>date: <input type="text" id="datepicker"></p> </form> </div> </div> </div> <!-- jquery --> <script src="js/jquery.min.js"></script> <!-- bootstrap core javascript --> <script src="js/bootstrap.min.js"></script> <!-- metis menu plugin javascript --> <script src="js/metismenu.min.js"></script> <!-- custom theme javascript --> <script src="js/startmin.js"></script> </body> </html>
thank help!!
i see you're including jquery twice (on header , @ bottom). defitively problem. first thing try delete last jquery reference.
next step refactoring move scripts references , code bottom of page improve page load performance that's not strictly related problem, improvement.
edit
now know last reference problem i'll write how should handle scripts on particular page better performance. notice moved script @ bottom.
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="http://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css"> <link rel="stylesheet" href="http://jqueryui.com/resources/demos/style.css"> <title>dashboard</title> <!-- bootstrap core css --> <link href="css/bootstrap.min.css" rel="stylesheet"> <!-- metismenu css --> <link href="css/metismenu.min.css" rel="stylesheet"> <!-- timeline css --> <link href="css/timeline.css" rel="stylesheet"> <!-- custom css --> <link href="css/startmin.css" rel="stylesheet"> <!-- morris charts css --> <link href="css/morris.css" rel="stylesheet"> <!-- custom fonts --> <link href="css/font-awesome.min.css" rel="stylesheet" type="text/css"> </head> <body> .... html content <!-- jquery --> <script src="js/jquery.min.js"></script> <!-- jquery ui --> <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script> <!-- bootstrap core javascript --> <script src="js/bootstrap.min.js"></script> <!-- metis menu plugin javascript --> <script src="js/metismenu.min.js"></script> <!-- custom theme javascript --> <script src="js/startmin.js"></script> <script> $( function() { $("#datepicker").datepicker(); }); </script> </body> </html>
Comments
Post a Comment