Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
55
rated 0 times [  60] [ 5]  / answers: 1 / hits: 37757  / 12 Years ago, tue, june 12, 2012, 12:00:00

Getting an error using indexOf call in Javascript on Firefox and Opera. Works fine in IE.



Following is the error message:



Action



function anonymous(Grid, Row, Col, Event) { 
return Grid.ActionShowPopupMenu();
}


for event OnRightClick failed with exception: row.id.indexOf is not a function



I'm testing that a string contains another string in Javascript and using the indexOf function of a string. The calls however are being made in JQuery functions. Perhaps that is the reason for the problem? Is there an alternative to using indexOf in Javascript to test if a string contains another string? Is there a workaround for this problem?


More From » jquery

 Answers
25

String.indexOf is perfectly OK in all browsers. I assume the id property of your row object is no string (nor array, btw, because indexOf is also defined on arrays (except for IE))


[#84974] Monday, June 11, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
jamir

Total Points: 736
Total Questions: 97
Total Answers: 101

Location: Cayman Islands
Member since Fri, Mar 4, 2022
2 Years ago
;