我想设置可见valError
。我尝试了一切,但它不起作用。有人可以帮助我吗?
<script type="text/javascript">
function ValidateTextBox(elem) {
if (elem.val() == "") {
return false;
}
else return true;
}
function ValidateForm() {
var a = ValidateTextBox($('[id$=txtBxLangName]'));
if (a)
return true;
else {
$('#valError').html('Please fill required field');
$('#valError').show();
return false;
}
}
</script>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<div class="alert alert-error" visible="false" id="valError" runat="server">
</div>
<asp:TextBox ID="txtBxLangName" runat="server" CssClass="textEntry">
</asp:TextBox>
<asp:Button ID="btnNewAndUpdate" runat="server" Text="Save" OnClick="btnNewAndUpdate_Click" OnClientClick="return ValidateForm()" />
</asp:Content>