Unhandled exception: 0x800a138f - JavaScript runtime error

0

I am getting the below mentioned exception while i am trying to add a rule to a Radiobutton List by calling rules() method.

Unhandled exception at line 3747, column 3 in http://localhost:XXXXX/Scripts/jquery-2.2.3.js 0x800a138f - JavaScript runtime error: Unable to get property 'jQuery223064526755237397352' of undefined or null reference

I have used the below code:

$('#' +RadioButton_ID).each(function () {                    
                        FieldRequired($(this), true);                    
                }
}
function FieldRequired(field, boolean) {
    if (boolean == true) {
        field.rules("add",
            {
                required: true,
                messages:
                {
                    required: errorMessage_Required
                }
            });
    }
}
javascript
jquery
asked on Stack Overflow May 11, 2017 by Manas Maity • edited May 11, 2017 by Manas Maity

1 Answer

0

Two things from just looking at it.

Your each is missing a closing bracket ")".

You are iterating over an id with each. Ids should be unique in your project.

Edit: Depending on what you want you might want to use something else here than $(this). If you really have multiple elements you want to iterate over with each, maybe try this:

xyz.each(function (index, element) {
    FieldRequired(element, true);
}
answered on Stack Overflow May 11, 2017 by Morfium • edited May 11, 2017 by Morfium

User contributions licensed under CC BY-SA 3.0