0

I have a modal popup with several links inside that have the :confirm and :method => :delete options. The problem is I am using stopPropagation to prevent the modal from closing when a user clicks inside the div content area.

event.stopPropagation();

However, this disables any of the javascript that Rails uses for the links that have :remote => true or :confirm or :method.

Does anyone know a workaround to this problem?

Thanks!!

chourobin
  • 4,004
  • 4
  • 35
  • 48

1 Answers1

1

you could get the url from the link's href attribute and set it to the window's location href attribute... It'l look something like this:

var linkUrl = document.querySelector("a#IdOfTheLinkYouWant").href;
window.location.href = linkUrl;
JKing
  • 807
  • 5
  • 14
  • (there are, of course, many variations on this that would work. For instance, you might be able to grab a reference to the link you want using `event.target` or something. And you might need to do a little more work (filling in the protocol/domain/current path) if the links are to relative paths... – JKing Apr 09 '12 at 01:38