This might seem trivial, but I\'m new to JS. I have this piece of code:
alert(elementAction);
var argumentsBegin = elementAction.search(\"(\");
var argum
Yes: the search()
method of strings expects a regular expression as the parameter and is treating the string you're passing as a regular expression pattern, in which parentheses have special meaning. Use indexOf()
instead:
alert( elementAction.indexOf("(") );
elementAction.search("\\(");
search is regular expression, ( is keyword in regular expression. you have to escape (
to \(
,
\(
in string is "\\("