我需要检查TextBox是否有值,然后只读取该字段。我正在使用AutoPostBack="false"
,所以我猜不会在后端进行。
这是我的代码:
Aspx页面:
<telerik:RadButton runat="server" AutoPostBack="false" CssClass="btnLookup topIngbtnLookup" ID="btnIngredientsLookUp" Image-ImageUrl="~/Images/searchIng.PNG" />
JavaScript的:
$('#txtIngredientsName').keypress(function () {
if ($(this).val() != '') {
$(this).addClass('readOnlyFields');
}
else {
$(this).removeClass('readOnlyFields');
}
});
CSS:
.readOnlyFields {
pointer-events: none !important;
background-color: #ccc !important;
}