Javascript 单击非活动文本框时禁用日期选择器

Javascript 单击非活动文本框时禁用日期选择器,javascript,jquery,textbox,bootstrap-datepicker,Javascript,Jquery,Textbox,Bootstrap Datepicker,如何在单击处于非活动状态的文本框时禁用日期选择器?我使用了以下属性readonly,disabled,这没有帮助 感谢您的帮助。 谢谢 我的代码: $("[id$=_txtTDate]").datepicker(); <td width="225px"> <asp:TextBox ID="txtTDate" runat="server" MaxLength="10" Text='<%#Eval("TDate").ToShortDateString() %>' T

如何在单击处于非活动状态的文本框时禁用日期选择器?我使用了以下属性readonly,disabled,这没有帮助

感谢您的帮助。 谢谢

我的代码:

$("[id$=_txtTDate]").datepicker();
<td width="225px">
  <asp:TextBox ID="txtTDate" runat="server" MaxLength="10" Text='<%#Eval("TDate").ToShortDateString() %>' ToolTip='<%#Eval("TDate").ToShortDateString() %>' Width="150" CssClass="datepicker form-control form-control-inline" ReadOnly="true" />
</td>
$(“[id$=\u txtTDate]”)。日期选择器();
您可以使用JQuery的off()方法禁用特定元素上的任何事件。还可以使用not()方法跳过特定元素的任何特定事件

例如下面的元素

First: <input type="text" name="f" value="1"><br>
Second: <input type="text" name="s" class="myclass" value="2"> <br>

Third: <input type="text" name="t" disabled value="3"> <br> 

请显示一些代码。。。您的HTML和用于日期选择器的JS。另外,它是jQuery日期选择器还是引导日期选择器?您提供的相关信息越多,您将得到最准确的答案。$(“[id$=\u txtTDate]”);下次请使用问题下方的“编辑”链接。我是为你做的。看见您正在使用ASP。。。这是一个重要的信息。
// Use not as [all except]
$("input:not(.myclass)").on("click", function() {
    alert($(this).val());
});

// Or Use off()
$("input:disabled").off(event);