Javascript 在单击事件中显示日历
此代码在输入框中运行良好。在标记中不起作用 我希望在标记“sample”中获得相同的操作 我附上了我的密码Javascript 在单击事件中显示日历,javascript,jquery,html,Javascript,Jquery,Html,此代码在输入框中运行良好。在标记中不起作用 我希望在标记“sample”中获得相同的操作 我附上了我的密码 <div id="datepickerContainer"> </div> <input id="datepicker" type="text"> <script src="/external/jquery.js"></script> <script src="/jquery-ui.js"></script&g
<div id="datepickerContainer">
</div>
<input id="datepicker" type="text">
<script src="/external/jquery.js"></script>
<script src="/jquery-ui.js"></script>
<script>
$( "#datepicker" ).datepicker({
inline: true
});
$('#datepickerContainer').on('click',function() { $( "#datepicker" ).datepicker('show'); });
// Hover states on the static widgets
$( "#dialog-link, #icons li" ).hover(
function() {
$( this ).addClass( "ui-state-hover" );
},
function() {
$( this ).removeClass( "ui-state-hover" );
}
);
</script>
$(“#日期选择器”)。日期选择器({
内联:对
});
$('datepickerContainer')。on('click',function(){$('datepicker')。datepicker('show');});
//静态小部件上的悬停状态
$(“#对话框链接,#图标li”)。悬停(
函数(){
$(this.addClass(“ui状态悬停”);
},
函数(){
$(this.removeClass(“ui状态悬停”);
}
);
使用下面的html和JavaScript代码
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="http://www.jscodes.com/codes/calendar_javascript/demo/css/datePicker.css" />
<script src="http://www.jscodes.com/codes/calendar_javascript/demo/js/jquery-1.6.1.min.js" type="text/javascript"></script>
<script src="http://www.jscodes.com/codes/calendar_javascript/demo/js/jquery.datePicker-min.js" type="text/javascript"></script>
<title>Content Delv Logs</title>
<script type="text/javascript">
$(window).ready(function() {
$('#date-pick').datePicker({clickInput: true});
});
</script>
</head>
<body>
<input type="text" name="date" id="date-pick" value=""/>
</body>
</html>
内容删除日志
$(窗口).ready(函数(){
$(“#日期选取”).datePicker({clickInput:true});
});
发布您的html并创建一个提琴。我不知道如何创建一个提琴,而我希望它在这一行的输入框中获取日期。将上述代码保存为html文件,然后再试一次,您将得到您的答案:-)