diff --git a/app/views/render_async/_request_jquery.js.erb b/app/views/render_async/_request_jquery.js.erb index e5457ea..35fbf75 100644 --- a/app/views/render_async/_request_jquery.js.erb +++ b/app/views/render_async/_request_jquery.js.erb @@ -86,7 +86,7 @@ if (window.jQuery) { <% if toggle %> $(document).on('<%= toggle[:event] || 'click' %>', '<%= toggle[:selector] %>', function(event) { event.preventDefault(); - if (_interval) { + if (typeof _interval === 'number') { clearInterval(_interval); _interval = undefined; } else { diff --git a/app/views/render_async/_request_vanilla.js.erb b/app/views/render_async/_request_vanilla.js.erb index 298502c..10a2ada 100644 --- a/app/views/render_async/_request_vanilla.js.erb +++ b/app/views/render_async/_request_vanilla.js.erb @@ -102,7 +102,7 @@ [...selectors].forEach(function(selector) { selector.addEventListener('<%= toggle[:event] || 'click' %>', function(event) { event.preventDefault(); - if (_interval) { + if (typeof _interval === 'number') { clearInterval(_interval); _interval = undefined; } else {