I am trying to apply a Red border to fields that have failed validation using the following code:
The validation itself works fine. But the red border never gets applied. If I remove the Telerik script references and reference non-Telerik JQuery, the red border gets applied correctly.
I would like to continue using the Telerik script references for maximum compatibility with the RadControls which I use extensively. So I'd appreciate any ideas about how to get around this problem. Thanks!
<form id="form1" runat="server"> <telerik:RadScriptManager ID="RadScriptManager1" runat="server"> <Scripts> <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" /> <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" /> <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js" /> </Scripts> </telerik:RadScriptManager> <div> <asp:TextBox ID="TextBox1" runat="server" /> <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="TextBox1" ErrorMessage="RequiredFieldValidator" /> </div> <asp:Button ID="Button1" runat="server" Text="Test" /> <script type="text/javascript"> $(function () { if (typeof ValidatorUpdateDisplay != 'undefined') { var originalValidatorUpdateDisplay = ValidatorUpdateDisplay; ValidatorUpdateDisplay = function (val) { if (!val.isvalid) { $("#" + val.controltovalidate).css("border", "2px solid red"); } originalValidatorUpdateDisplay(val); } } }); </script></form>The validation itself works fine. But the red border never gets applied. If I remove the Telerik script references and reference non-Telerik JQuery, the red border gets applied correctly.
I would like to continue using the Telerik script references for maximum compatibility with the RadControls which I use extensively. So I'd appreciate any ideas about how to get around this problem. Thanks!