Recently, I created a basic JavaScript function to validate textboxes on an ASPX page
<body>
<script type="text/javascript" >
function checkTextbox(sender, target) {
if (document.getElementById(sender).value < document.getElementById(target).value) {
var lbl = document.getElementById('<%=lbl_Outlet_Message.ClientID %>');
lbl.style.display = 'block';
lbl.value = "Enter Slab To Value should be greater or equals to From Value ";
}
}
</script>
<form id="form1" runat="server">
<asp:Label ID="lbl_Outlet_Message" runat="server" ForeColor="Red" Visible="False"></asp:Label>
<asp:TextBox ID="txt_from_02" runat="server" ></asp:TextBox>
<asp:TextBox ID="txt_to_02" runat="server" onKeyUp="checkTextbox(this,'txt_from_02')">
</asp:TextBox>
</form>
</body>
Upon running the ASPX page, I encountered the following error message: "0x800a01a8 - Microsoft JScript runtime error: Object required". Unfortunately, identifying where exactly I went wrong has been challenging.