Javascript Error: unterminated regular expression literalI recently ran into a problem where a web page I was developing was giving this error in the Javascript terminal when I clicked on a button:
Error: unterminated regular expression literal I had a button with an onClick event that was supposed to go to a page called /editSettings.php when it was clicked. But when I clicked on the button, I got the error. Here's the code for the button: <button onClick="/editSettings.php">Edit</button> The problem, which will be obvious to many, is that for an onClick event it is executing javascript, so just putting a link in there will lead to unexpected behavior. And in my case, this error message. The simple fix to get to the desired page when click the button is this: <button onClick="window.location='/editSettings.php';">Edit</button> Making this quick change got rid of the unterminated regular expression literal error.
|

