无法使用jquery ui datetimepicker(node.js+ejs+express)

无法使用jquery ui datetimepicker(node.js+ejs+express),jquery,node.js,express,datetimepicker,ejs,Jquery,Node.js,Express,Datetimepicker,Ejs,我试着用这个: 这是我的密码: <html> <head> <script src="http://trentrichardson.com/examples/timepicker/js/jquery-1.7.1.min.js"> </script> <script src="http://trentrichardson.com/examples/timepicker/js/jquery-ui-1.8.16.custo

我试着用这个:

这是我的密码:

<html>
<head>
    <script src="http://trentrichardson.com/examples/timepicker/js/jquery-1.7.1.min.js">     </script>
    <script src="http://trentrichardson.com/examples/timepicker/js/jquery-ui-1.8.16.custom.min.js"></script>
    <script src="http://trentrichardson.com/examples/timepicker/js/jquery-ui-sliderAccess.js"></script>
    <script src="http://trentrichardson.com/examples/timepicker/js/jquery-ui-timepicker-addon.js"></script>
    <link type="text/css" href="http://trentrichardson.com/examples/timepicker/css/ui-lightness/jquery-ui-1.8.16.custom.css" rel="stylesheet">   

<script>

$(function() {
  $('#dateTimePicker1').datetimepicker();
});

</script>

</head>
<body>
    <%-body%>      
</body>
</html>
我检查过了,页面加载后输入到代码中

但是,奇怪的是:我在这篇文章的第一个链接上打开了作者的插件。打开开发人员工具。编辑站点的html-在示例输入附近添加新输入。姓名和身份证,例如222。在控制台中做什么

$('#example222').datetimepicker();

他的输入有效,我的无效!那是什么魔法

首先,我认为您的脚本是在加载DOM之前执行的,这是错误的,因为它被包装在$。。。并且应该像包装在$中一样。就绪

如果您没有得到任何错误,这意味着代码找不到任何与选择器匹配的DOM元素,这意味着您的模板没有被应用

请检查浏览器中的源代码是否具有或仍然包含ejs模板

那么,您能告诉我们如何在node.js中调用渲染吗

编辑:问题是jQuery代码没有执行

这将通过以下方式证明:


你找到解决办法了吗?我在同一个安装节点+ejs+Expression中面临相同的问题找到解决方案了吗?好像有个虫子。
exports.index = function(req, res){
  res.render('index', { title: 'index' })
};
$('#example222').datetimepicker();
<html>
    <head>
        <script src="http://trentrichardson.com/examples/timepicker/js/jquery-1.7.1.min.js">     </script>
        <script src="http://trentrichardson.com/examples/timepicker/js/jquery-ui-1.8.16.custom.min.js"></script>
        <script src="http://trentrichardson.com/examples/timepicker/js/jquery-ui-sliderAccess.js"></script>
        <script src="http://trentrichardson.com/examples/timepicker/js/jquery-ui-timepicker-addon.js"></script>
        <link type="text/css" href="http://trentrichardson.com/examples/timepicker/css/ui-lightness/jquery-ui-1.8.16.custom.css" rel="stylesheet">
    </head>
    <body>
        <input id="dateTimePicker"></input>  
        <script type="text/javascript">
            $(document).ready(function() {
                $('#dateTimePicker').datetimepicker();
            });
        </script> 
    </body>
</html>