从jQuery datepicker内联中选择日期后,打开jQuery对话框 [英] Open jQuery dialog box upon selecting a date from jQuery datepicker inline

查看:112
本文介绍了从jQuery datepicker内联中选择日期后,打开jQuery对话框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前,我的项目页面正在放置一个页面部分的jQuery datepicker内联。以下代码用于实现相同的。

Presently my project page is having a jQuery datepicker inline placed on one of the section of the page. The below code is used to achieve the same.

<link rel="stylesheet" href="~/Scripts/Calendar/jquery-ui-1.10.1.custom.css">
<script src="~/Scripts/Calendar/jquery-1.9.1.js"></script>
<script src="~/Scripts/Calendar/jquery-ui-1.10.1.custom.js"></script>
<script>
$(document).on("change", "#datepicker", function () {
    var date = $(this).val();
    $( "#dialog" ).dialog();
});
</script>

// The below section is in one of the sections
<div id="datepicker" style="font: 80% 'Trebuchet MS', sans-serif;"></div>
<script>
    $("#datepicker").datepicker();
</script>
.
.
.
<div id="dialog-modal" title="Basic modal dialog">
   <p>Adding the modal overlay screen.</p>
 </div>

现在,当用户在特定日期点击时,我必须显示一个包含信息的jQuery对话框。

Now I would have to show a jQuery dialog with information, when the user click's on a specific date.

我试图调用对话框

$(document).on("change", "#datepicker", function () {
    var date = $(this).val();
    $( "#dialog" ).dialog();
});

但它显示错误,因为Object不支持属性或方法对话框。

but it shows an error as Object doesn't support property or method dialog.

任何身体都能使我朝着正确的方向。

Could any body put me in the right direction.

谢谢

推荐答案

看看这个小提琴是否有帮助。

Have a look this fiddle to see if this helps.

http://jsfiddle.net/qqabC/

 $("#datepicker").datepicker();

$("#datepicker").change(function(){
     var date = $(this).val();
    $('<div>' + date + '</div>').dialog();
});

这篇关于从jQuery datepicker内联中选择日期后,打开jQuery对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆