问题描述
在我的网页中,我已将日历设置为下拉列表,但会自动加载
我的代码如下
$ b b
< li class =dropdown>
< input type =textclass =form-control dropdown-toggledata-toggle =dropdowndata-hover =dropdownname =txtEndsid =txtEndsrequired&
< ul class =dropdown-menustyle =display:none;>
< li>< div id =showDates>< / div>< / li>
< / ul>
< / li>
使用showdates id我创建了一个日历。所有的东西都工作正常,但问题是它是自动加载在启动它使我的网站不好看。我需要让它只显示它点击文本框
对不起,这个简单的问题,但我不知道是什么问题,请帮助我
忘记所有。这是一个工作日历。
$(function(){$(#datepicker)。datepicker({autoclose:true,todayHighlight: true})。datepicker('update',new Date());;});
#datepicker {width:180px; margin:0 20px 20px 20px;}#datepicker> span:hover {cursor:pointer;}
< script src =https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js>< / script>< link href =http://cdnjs.cloudflare。 com / ajax / libs / bootstrap-datepicker / 1.3.0 / css / datepicker.cssrel =stylesheet/>< link href =http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/ css / bootstrap.min.cssrel =stylesheet/>< script src =http://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.3.0/js/bootstrap-datepicker。 js>< / script>< script src =http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js>< / script>< div id =datepickerclass =input-group datedata-date-format =mm-dd-yyyy> < input class =form-controltype =textreadonly /> < span class =input-group-addon>< i class =glyphicon glyphicon-calendar>< / i>< / span>< / div>
/ pre>
你在那里...工作正常,这里有数百个版本。
In my page i have set calendar as dropdown but it automatically loads in start up
my code is like this
<li class="dropdown">
<input type="text" class="form-control dropdown-toggle" data-toggle="dropdown" data-hover="dropdown" name="txtEnds" id="txtEnds" required >
<ul class="dropdown-menu" style="display:none;">
<li><div id="showDates"></div></li>
</ul>
</li>
using showdates id i have created a calendar. All things are working properly but the problem is it is automatically loading in startup it makes a bad look to my site. I need to make that to only displaying it on clicking the textbox
Sorry for this simple question but i dont know what is the problem in it please help me
Forget all. Here is a working calendar.
$(function () {
$("#datepicker").datepicker({
autoclose: true,
todayHighlight: true
}).datepicker('update', new Date());;
});
#datepicker{width:180px; margin: 0 20px 20px 20px;}
#datepicker > span:hover{cursor: pointer;}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link href="http://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.3.0/css/datepicker.css" rel="stylesheet"/>
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet"/>
<script src="http://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.3.0/js/bootstrap-datepicker.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
<div id="datepicker" class="input-group date" data-date-format="mm-dd-yyyy">
<input class="form-control" type="text" readonly />
<span class="input-group-addon"><i class="glyphicon glyphicon-calendar"></i></span>
</div>
There you go... Works fine and made in bootstrap. There are literally hundreds of versions of this.
这篇关于删除自动加载下拉菜单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!