datepicker(Bootstrap)不起作用? [英] Does not work datepicker (Bootstrap)?

查看:575
本文介绍了datepicker(Bootstrap)不起作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

要在输入-日历中显示(日期选择器(Bootstrap)). 问题在于,在前一种情况下,它显示为:

To be displayed in the input - calendar (datepicker (Bootstrap)). The problem is that in the former case, it appears:

<input type="text" class="datepicker_goal" data-provide="datepicker" value="Period">

$('.modal-body input[data-provide="datepicker"]').datepicker();

但是当您激活另一个表单标签并添加时,我创建了一个模式窗口.

But I have a modal window is created when you activate another form tag and added:

<input type="text" class="datepicker_goal_modal" data-provide="datepicker_modal" value="Period">

$('.modal-body input[data-provide="datepicker_modal"]').datepicker();

但是在第二实施例中,日期选择器未被激活并且日历不可见.甚至发生冲突,也会关闭模式窗口. 告诉我我做错了什么以及如何解决?如何以所有字段模式形式显示日历?

But in the second embodiment, datepicker is not activated and the calendar is not visible. And even conflicting something closes the modal window. Tell me what I did wrong and how to fix it? How to display the calendar in all fields modal form?

推荐答案

以下是有效的 Jsfiddle 以供参考.在输入字段中附加了模式弹出窗口和日期选择器.

Here is the working Jsfiddle for reference. It has modal popup and datepicker attached to input field.

$('input[data-provide="datepicker"]').datepicker();    

// Append New Input field
$("div.modal-body").append(" <input type=\"text\" class=\"datepicker_goal_modal\" data-provide=\"datepicker_modal\" placeholder=\"Period\">")

// After appending, call datepicker on input field.
$('.modal-body input[data-provide="datepicker_modal"]').datepicker();

这篇关于datepicker(Bootstrap)不起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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