Wednesday, 26 October 2016

jQuery - Fix the following error: 0x800a138b - JavaScript runtime error: Cannot assign to a function result

 Watch this example on YouTube:


 Error:
0x800a138b - JavaScript runtime error: Cannot assign to a function result


To fix it replace
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
   
    <script  type="text/javascript" src="Scripts/jquery-1.10.2.js"></script>
    <script type="text/javascript">
        $(document).ready(function(){
            $('.rb').click(function () {
                $('#TextBox1').val()='';
                $('#TextBox2').val()='';

            });
        });
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:RadioButton ID="RadioButton1" runat="server" class="rb" GroupName="test" />
        <asp:RadioButton ID="RadioButton2" runat="server" class="rb" GroupName="test" />
        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
        <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
    </div>
    </form>
</body>
</html>

With

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
   
    <script  type="text/javascript" src="Scripts/jquery-1.10.2.js"></script>
    <script type="text/javascript">
        $(document).ready(function(){
            $('.rb').click(function () {
                $('#TextBox1').val()='';
                $('#TextBox2').val()='';
                $('#TextBox1').val('');
                $('#TextBox2').val('');

            });
        });
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:RadioButton ID="RadioButton1" runat="server" class="rb" GroupName="test" />
        <asp:RadioButton ID="RadioButton2" runat="server" class="rb" GroupName="test" />
        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
        <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
    </div>
    </form>
</body>
</html>

No comments:

Post a Comment