Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IE + jQuery 1.4.2 + live('submit', ... #8

Closed
galetahub opened this issue Jun 1, 2010 · 6 comments
Closed

IE + jQuery 1.4.2 + live('submit', ... #8

galetahub opened this issue Jun 1, 2010 · 6 comments

Comments

@galetahub
Copy link

Not work in IE with jQuery 1.4.2
http://forum.jquery.com/topic/ie-specific-issues-with-live-submit
$('form[data-remote]').live('submit', function (e) {

    $(this).callRemote();
    if(e.preventDefault) e.preventDefault();

});

Path for IE

if (jQuery.browser.msie){
  $("form[data-remote]").find("input[type='submit'],button[type='submit'],input[name='commit']").live('click',function(e) {
      $(this).parents("form[data-remote]").callRemote();
      if(e.preventDefault) e.preventDefault();
  });
}
@josevalim
Copy link
Contributor

Sweet! I talked to Yehuda Katz and let's hold on a little bit more before applying it to see if jQuery Core will release a new version with this IE fix.

@sfenig
Copy link

sfenig commented Jul 23, 2010

That IE workaround didn't actually work for me cause it seemed to target all submits with with a live click intercept.
I used
if (jQuery.browser.msie){
$("form[data-remote]").delegate("input[type='submit'],button[type='submit'],input[name='commit']", 'click', function(e) {
$(this).parents("form[data-remote]").submit();
if(e.preventDefault) e.preventDefault();
});
}

@jfirebaugh
Copy link

http://dev.jquery.com/ticket/6359 is the most relevant upstream bug.

@mpakes
Copy link

mpakes commented Sep 23, 2010

I just sent a pull request for a fix to this issue. See commit 7d260bc on mpakes/jquery-ujs.

Here's the workaround:

$('form[data-remote]', $.browser.msie ? $('body')[0] : $(document)).live('submit', function(e) { 
    $(this).callRemote();
    e.preventDefault(); 
});

The submit event handler is bound to rather than document, which IE seems to handle just fine.

Matt

@jfirebaugh
Copy link

This is fixed upstream in jQuery 1.4.3.

@neerajsingh0101
Copy link

Recommending core team to close this ticket.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants