admin管理员组文章数量:1327969
I am trying to build my personal website using express and want to put a datepicker on one of the page. I tried to change the ejs file of this page, however, nothing works. I am wondering if it is because that the layout.ejs file exists, and wondering how can I just load jquery-ui in only of the ejs.file? Because I cannot find any related npm to install . Many thanks for answering!XD
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href=".8.16/themes/smoothness/jquery-ui.css" media="all">
<script type="text/javascript" src=".7.1/jquery.min.js"></script>
<script type="text/javascript" src=".8.16/jquery-ui.min.js"></script>
</head>
<body>
<script>
$(function() {
$( "#datepick" ).datepicker();
});
</script>
<aside class="widget">
<p>Date: <input type="text" id="datepick"></p>
</aside>
</body>
</html>
There is another similar question, but I think the answer does not works for me. node.js - DatePicker jquery UI not workinng
When I just use Express and change the index.ejs like the following, it works , but when there are many pages, it seems that it cannot be loaded...
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href=".8.16/themes/smoothness/jquery-ui.css" media="all">
<script type="text/javascript" src=".7.1/jquery.min.js"></script>
<script type="text/javascript" src=".8.16/jquery-ui.min.js"></script>
<script>
$(function() {
$('#datepick').datepicker();
});
</script>
</head>
<body>
<aside class="widget">
<p>Date: <input type="text" id="datepick"></p>
</aside>
</body>
</html>
I am trying to build my personal website using express and want to put a datepicker on one of the page. I tried to change the ejs file of this page, however, nothing works. I am wondering if it is because that the layout.ejs file exists, and wondering how can I just load jquery-ui in only of the ejs.file? Because I cannot find any related npm to install . Many thanks for answering!XD
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="https://ajax.googleapis./ajax/libs/jqueryui/1.8.16/themes/smoothness/jquery-ui.css" media="all">
<script type="text/javascript" src="https://ajax.googleapis./ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis./ajax/libs/jqueryui/1.8.16/jquery-ui.min.js"></script>
</head>
<body>
<script>
$(function() {
$( "#datepick" ).datepicker();
});
</script>
<aside class="widget">
<p>Date: <input type="text" id="datepick"></p>
</aside>
</body>
</html>
There is another similar question, but I think the answer does not works for me. node.js - DatePicker jquery UI not workinng
When I just use Express and change the index.ejs like the following, it works , but when there are many pages, it seems that it cannot be loaded...
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="https://ajax.googleapis./ajax/libs/jqueryui/1.8.16/themes/smoothness/jquery-ui.css" media="all">
<script type="text/javascript" src="https://ajax.googleapis./ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis./ajax/libs/jqueryui/1.8.16/jquery-ui.min.js"></script>
<script>
$(function() {
$('#datepick').datepicker();
});
</script>
</head>
<body>
<aside class="widget">
<p>Date: <input type="text" id="datepick"></p>
</aside>
</body>
</html>
Share
Improve this question
edited May 23, 2017 at 11:53
CommunityBot
11 silver badge
asked Feb 3, 2014 at 17:26
DQ_happyDQ_happy
5152 gold badges7 silver badges21 bronze badges
4
- Why are you including jQuery UI twice? And jQuery itself twice? – Pointy Commented Feb 3, 2014 at 17:31
- Because I am making sure if the JQuery-UI is loaded,so apart from using a local one, I also include one from the website....but it does not work either... – DQ_happy Commented Feb 3, 2014 at 17:33
- You're including jQuery 1.10.2, and then after that you're including jQuery 1.7.1, a substantially older version. Don't do that. – Pointy Commented Feb 3, 2014 at 17:34
- Thanks for the advice, I just deleted them! – DQ_happy Commented Feb 3, 2014 at 17:44
2 Answers
Reset to default 2node.js - DatePicker jquery UI not workinng
For whom run into the same problem, this is the reference.
I finally found the answer by checking the code.I was unable to load JQuery for in the layout.ejs, I retyped the following in order to load the bootstrap, but actually by using https://npmjs/package/twitter-bootstrap-node twitter-bootstrap-node, there is no-need to load the javascripts again. This may be a mon problems for beginners in Node.JS like me.Hope this answer can be helpful to people who run into the same problem and the code is in the answer of the related problem.
<script src="/javascripts/jquery.js"></script>
<script src="/javascripts/bootstrap.js"></script>
<script src="/vendor/twitter/less/bootstrap.less"></script>
Hi look at this jsfiddle link http://jsfiddle/w7PHj/
you need to use like this....
$('#datepick').datepicker();
本文标签: javascriptDatePicker jquery UI not workingStack Overflow
版权声明:本文标题:javascript - DatePicker jquery UI not working - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742175535a2427504.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论