我在asp.net中的母版页中的Datepicker代码如下
<link href="~/AppThemes/js/datepicker/datepicker.css" runat="server" rel="stylesheet" />
<script src="<%= Page.ResolveClientUrl("~/AppThemes/js/datepicker/bootstrap-datepicker.js") %>"></script>
<script type="text/javascript">
$(document).ready(function () {
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
function EndRequestHandler(sender, args) {
var dp = $(".datePicker1");
var a = dp.datepicker({ dateFormat: 'YYYY-MM-DD' });
}
});
</script>
我的DatePicker Html代码在content6页面下面
<div class="form-group">
<label>License Expiry Date</label>
<div class="input-group date" >
<span class="input-group-addon add-on entypo-calendar datePicker1"></span>
<asp:TextBox ID="txtDlExpDate" runat="server" CssClass="form-control datePicker1" placeholder="YYYY/MM/DD"> </asp:TextBox>
</div>
</div>
当我点击文本框时,jquery无效。我在母版页上导入Jquery和CSS文件,我在内容页面中使用它有什么问题请帮帮我。
答案 0 :(得分:1)
从span中删除datePicker1
类,只需使用
<div class="input-group date" >
<span class="input-group-addon add-on entypo-calendar"></span>
<asp:TextBox ID="txtDlExpDate" runat="server" CssClass="form-control datePicker1" placeholder="YYYY/MM/DD"> </asp:TextBox>
</div>