jquery-ujs icon indicating copy to clipboard operation
jquery-ujs copied to clipboard

Uncaught SyntaxError: Invalid regular expression: /(^|\.)rails(\.|$)/: Stack overflow

Open JohnMerlino2 opened this issue 7 years ago • 1 comments

I have a select element which has a remote: true to my contacts controller. However, if one of the options is selected, then I want to cancel that remote call and invoke a different controller instead. In the ajax:beforeSend event, I check if the specific option is selected and then return false:

if( $select.val() == "1" ){
    $('.loading').hide();
    $select.find('option:selected') .trigger('change.rails');
   return false;

The return false works and the original ajax call is stopped. However, the selected option looks like this:

<option data-url="/contacts/edit_multiple" data-remote="true" data-type="html" data-method="post" data-params="filterable=Lead" data-toggle="modal" data-target="filterEdit" value="1">Edit/Delete Filter</option>

And when I trigger the change.rails event on it, I get the following error:

Uncaught SyntaxError: Invalid regular expression: /(^|.)rails(.|$)/: Stack overflow

Anyone know why this error occurs?

JohnMerlino2 avatar Apr 06 '17 00:04 JohnMerlino2

I have the same problem it looks like a jQuery issue

wattry avatar Nov 01 '19 19:11 wattry