twitter-bootstrap Bootstrap 的日期选择器:嵌入式/内联

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/19290280/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 18:49:53  来源:igfitidea点击:

Datepicker for Bootstrap: Embedded / inline

twitter-bootstrapdatepicker

提问by FrancescoMussi

I like very much datepicker for Bootstrap by Eternicode: https://github.com/eternicode/bootstrap-datepicker

我非常喜欢 Eternicode 的 Bootstrap 日期选择器:https: //github.com/eternicode/bootstrap-datepicker

I use his form to generate what i want to insert in my site: the calendar in the format Embedded/inline.

我使用他的表单来生成我想在我的网站中插入的内容:嵌入式/内联格式的日历。

http://eternicode.github.io/bootstrap-datepicker/?markup=embedded&format=dd%2Fmm%2Fyyyy&weekStart=&startDate=now&endDate=&startView=0&minViewMode=0&todayBtn=false&language=en&orientation=auto&keyboardNavigation=on&forceParse=on#sandbox

http://eternicode.github.io/bootstrap-datepicker/?markup=embedded&format=dd%2Fmm%2Fyyyy&weekStart=&startDate=now&endDate=&startView=0&minViewMode=0&todayBtn=false&language=en&orientation=auto&keyboardNavigation=on&forceParse=on#sand

As Jquery it is generated this code:

作为 Jquery,它生成了以下代码:

$('#sandbox-container div').datepicker({
    format: "dd/mm/yyyy",
    startDate: "now"
});

But as HTML it is generated only this code:

但作为 HTML,它只生成以下代码:

<div></div>

What HTML i have to put inside to have the calendar in Embedded/inline style? Thank you!

我必须在里面放入什么 HTML 才能使日历采用嵌入式/内联样式?谢谢!

回答by Alaa Badran

Use $('#sandbox-container').datepickerfor input field but not for Div

使用$('#sandbox-container').datepicker输入字段,但不Div

if you look at the demo here, you will see its an input

如果你看这里演示,你会看到它的一个输入

回答by Cyber

The actual fix is to give your Div and ID and reuse this id in your datepicker code:

实际的解决方法是给你的 Div 和 ID 并在你的日期选择器代码中重用这个 ID:

JS:

JS:

$('#sandbox-container').datepicker({
    format: "dd/mm/yyyy",
    startDate: "now"
});

html:

html:

<div id="sandbox-container"></div>

回答by Ashish

To put inside to have the calendar in Embedded/inline style. The html will be:<div id='sandbox-container'><div></div></div>

将日历放入嵌入式/内联样式。html 将是:<div id='sandbox-container'><div></div></div>