indexOf is not a function in Firefox, Opera but works in IE, indexOf alternative in javascript to test string contains?

indexof, javascript, jquery, string, testing

Solution

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))

Problem

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?

Original source

Related problems