我有以下代码,但是当我单击保存按钮时它不会触发或不显示任何错误。你能告诉我可能是什么问题吗?谢谢你。
<script type="text/javascript">
$(document).ready(function () {
$('input[id*=btnSave]').click(function () {
var txtFirstName = $('input[id*=txtFirstName]').val();
var txtLastName = $('input[id*=txtLastName]').val();
var errMsg = '';
var errMsg = "<ul>";
if (txtFirstName == '') {
errMsg = errMsg + "<li>First Name is required</li>";
return false;
}
if (txtLastName == '') {
errMsg = errMsg + "<li>Last Name is required</li>";
return false;
}
errMsg = errMsg + "</ul>";
});
});
</script>
<telerik:RadTextBox ID="txtLastName" runat="server" />
<telerik:RadTextBox ID="txtFirstName" runat="server"/>
<asp:Button ID="btnSave" runat="server" Text="Save" OnClick="btnSave_Click"></asp:Button>