links with 'data-disable-with' are still disabled after pressing the back button on rails 5 (turbolinks & jquery ujs)
Asked Answered
M

0

6

So I have a simple link:

%td= link_to("#{fa("institution")} #{entity.short_name}".html_safe, entity_path(entity), class: "button", data: {disable_with: "<i class=\"fa fa-spin fa-circle-o-notch\"></i>".html_safe})

When I press this link it shows a spinning icon and it redirects me to an other page. When I press the back button it still displays the spinning icon.

So I tried to fix this with multiple workarounds:

  • I read this issue and added autocomplete: "off" to the link but it does not work.
  • I found this question on SO, discovered the $.rails.enableElement() function and tried on my browser console:
  • $.rails.enableElement($("a"))
  • $.rails.enableElement($('[data-disable-with]'))

That doesn't work either. Do you have any idea why any of these solutions isn't working? any suggestion?

Ms answered 8/12, 2016 at 16:3 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.