I am trying to use JQuery UI datepicker in my node.js project and it doesn't work.
My simplified version of layout.ejs and index.ejs files.
layout.ejs
<head>
<script type="text/javascript" src="../1.4.2/jquery.min.js"></script>
<script type="text/javascript" src="../1.8.11/jquery-ui.min.js"></script>
<link rel="stylesheet" href="../jquery-ui.css" type="text/css" media="all" />
</head>
<body>
<script>
$(function() {
$( "#datepick" ).datepicker();
});
</script>
</body>
</html>
index.ejs
<aside class="widget">
<p>Date: <input type="text" id="datepick"></p>
</aside>
Working demo http://jsfiddle.net/MfkAE/
Check your scripts source again, better yet change it to google link as I mentioend below; rest you can see it all works fine in demo with riight source.
Hope it helps! :)
scripts
<link rel="stylesheet" type="text/css" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/themes/smoothness/jquery-ui.css" media="all">
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js"></script>
Code
$(document).ready(function() {
$("#datepick").datepicker();
});
the below code can be run in the EJS template engine with nodejs/express Layout.ejs
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/themes/smoothness/jquery-ui.css" media="all">
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js"></script>
<script>
$(function() {
$('#datepick').datepicker();
});
</script>
</head>
<body>
</body>
</html>
Index.ejs
<aside class="widget">
<p>Date: <input type="text" id="datepick"></p>