bootstrap-datepicker 在点击时没有响应
Posted
技术标签:
【中文标题】bootstrap-datepicker 在点击时没有响应【英文标题】:bootstrap-datepicker not responding on click 【发布时间】:2014-12-19 00:46:01 【问题描述】:我已按照link中给出的说明进行操作
我使用过 jquery1.9.1.js,并且我已将 bootstrap-datepicker.js、datepicker.css 添加到我的页面中。当我点击日历图标时它没有响应,这是我的代码。
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1" %>
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Apply</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="styles/css/mystyle.css" type="text/css" />
<link rel="stylesheet" href="styles/css/bootstrap.min.css">
<link rel="stylesheet" href="styles/datapicker/css/datepicker.css" />
</head>
<body>
<div class="container">
<div class="row">
<div class="col-lg-12 col-md-12 col-xs-12 bg">
<table border="0">
<tr>
<td>Name</td><td colspan="5"><input type="text" value="<bean:write name="e" property="name" />" /></td>
</tr>
<br />
<tr>
<td>Leave type</td><td colspan="5"><select>
<option>---------select Leave type---------</option>
<option>Personal</option>
<option>Medical</option>
<option>Tour</option>
</select></td>
</tr>
<tr>
<td>Leave <br/> Balance</td><td colspan="5">
<bean:define id="bal" name="leave" property="balance" />
<html:text property="balance" value="<%=bal.toString() %>" />
</tr>
<tr>
<td>From</td><td colspan="2"><div class="form-group row">
<div class="col-xs-8">
<label class="control-label">My Label</label>
<div class="input-group date" data-datepicker="true" id="dp3" data-date="12-02-2012" data-date-format="mm-dd-yyyy">
<input class="form-control" type="text" value="12-02-2012">
<span class="input-group-addon"><i class="glyphicon glyphicon-calendar"></i></span>
</div>
</div>
</div>
</td>
<td colspan="3"><select>
<option>-------select---------</option>
<option>session1</option>
<option>session2</option>
</select>
</td>
</tr>
<tr>
<td>To</td><td colspan="2"><input type="text"></td>
<td colspan="2"><select>
<option>-------select---------</option>
<option>session1</option>
<option>session2</option>
</select>
</td>
<td><a href="holidays.jsp">Holidays</a></td>
</tr>
<tr>
<td>Days</td><td colspan="5">0</td>
</tr>
<tr>
<td>Forward To/Approver</td><td colspan="5"><select>
<option>PLEASE SELECT-001</option>
<option>PLEASE SELECT-002</option>
<option>PLEASE SELECT-003</option>
<option>PLEASE SELECT-004</option>
</select>
</td>
</tr>
<tr>
<td>Reason</td><td colspan="5"> <textarea cols="50"></textarea></td>
</tr>
<tr>
<td>Contact Details</td><td colspan="5"> <textarea cols="50"></textarea></td>
</tr>
<tr>
<td><button class="btn btn-primary">cc</button></td><td colspan="4"> <textarea cols="50"></textarea></td><td><button class="btn btn-primary">clear</button></td>
</tr>
<tr>
<td colspan="6">(Separate multiple emails with commas)</td>
</tr>
<tr>
<td colspan="6"><a href="review.jsp">show all levels reviewer</a></td>
</tr>
<tr>
<td colspan="6"><button class="btn btn-primary">apply</button> <button class="btn btn-primary">cancel</button></td>
</tr>
</table>
</html:form>
</div>
</div>
</div>
</div>
</div>
</div>
<script src="styles/datepicker/js/bootstrap-datepicker.js"></script>
<script src="styles/js/bootstrap.js"></script>
<script src="styles/js/jquery-1.9.1.js"></script>
<script src="styles/js/dropdown.js"></script>
</body>
</html>
【问题讨论】:
【参考方案1】:也许最好按正确的顺序放置链接:
<script src="styles/js/jquery-1.9.1.js"></script>
<script src="styles/js/bootstrap.js"></script>
<script src="styles/datepicker/js/bootstrap-datepicker.js"></script>
<script src="styles/js/dropdown.js"></script>
【讨论】:
以上是关于bootstrap-datepicker 在点击时没有响应的主要内容,如果未能解决你的问题,请参考以下文章
在更改时验证 bootstrap-datepicker 字段
滚动模式时,bootstrap-datepicker 不滚动
使用 bootstrap-datepicker 时如何不显示移动键盘?