Reputation: 41822
In my jquery, I am getting error
Uncaught TypeError: object is not a function
Here is the code:
var localValues = new Array('txtA', 'txtB', 'txtC');
for (var intCount = 0; intCount < localValues.length; intCount++) {
var control = $('#' + localValues(intCount)); /* ERROR */
validationOfControls(control);
}
function validationOfControls(control) {
// code here
}
It seems to be silly mistake, but I cant figure it out..
Can you please explain what I am doing wrong here?
Upvotes: 1
Views: 103
Reputation: 72849
Replace:
localValues(intCount)
With:
localValues[intCount]
The round brackets ()
are used for function execution. Square brackets []
are used for array/object access.
Upvotes: 7