使用jqueryUI来制作一个日期选择器

公司的项目要用到时间选择器的一个插件,百度了很久,没有找到合适的,自己就看了下jqueryUI,自己整合了一个比较好的日期选择器,以便后面遇到同样的问题能够解决。

下面就贴出部分使用的代码,比较简单,但是很实用!!!

<!doctype html>
<html lang="en">

	<head>
		<meta charset="utf-8">
		<title>jQuery UI 日期选择器(Datepicker) - 默认功能</title>
		<link rel="stylesheet" href="//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">
		<script src="//code.jquery.com/jquery-1.9.1.js"></script>
		<script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
		<link rel="stylesheet" href="http://jqueryui.com/resources/demos/style.css">
		<!-引入jqueryUI的相关文件-->
		<style>
			#draggable {
				width: 150px;
				height: 150px;
				padding: 0.5px;
				border: 1px solid #F00
			}
		</style>
		<script>
			$(function() {
				$("#datepicker").datepicker({
					showOtherMonths: true,
					selectOtherMonths: true,
					showButtonPanel: true,
					/*显示今天的日期的显示,以及关闭时间选择器*/
					changeMonth: true,
					/*显示选择其他月份*/
					changeYear: true,
					/*显示选择其他年份*/
					dateFormat: "yy - mm - dd" /*设置日期的显示格式*/ ,
					showWeek: true,/*显示一年中的第几周*/
					firstDay: 1
				})
			});
		</script>
	</head>
	<body>
		<p>日期:
			<input type="text" id="datepicker">
		</p>
	</body>

</html>


关于JqueryUI的datepicker选择器的其他部分属性可以通过下面的链接查看:

jQuery UI API - 日期选择器部件


 

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值