WordPress.org

Ready to get started?Download WordPress

Forums

IE ignoring jQuery.delegate() (5 posts)

  1. duck__boy
    Member
    Posted 2 years ago #

    Hey all,

    I'm having a jQuery related problem and was wondering if someone here could help?

    My code below works fine in all browsers except IE (I know this becasue they all show the alert box except IE), yet for some reaseon the first a element within #attachment-body is still being prevented in IE -

    $('#attachment-body').delegate("a", "click", function(e){
    	alert('HERE!!!!');
    	e.preventDefault();
    });

    I've searched high and low for an answer to this, and it's been suggested that there is a problem with the WP core that causes IE to ignore these events in certain cases, but I'm lost as to where to look.

    Any help here would make me very happy.

    Thanks.

  2. Marventus
    Member
    Posted 2 years ago #

    Hi there,

    You may find this Stack Overflow thread helpful. It is suggested there that the issue should not be occurring anymore after jQuery 1.5 and IE 9.
    I also found this thread on the jQuery forums.
    That is all I was able to find.

    Hope that helps!

  3. duck__boy
    Member
    Posted 2 years ago #

    Thanks for the reply. I believe I have found the answer now, and it's all to do with the order in which IE runs commands - basically, it was running a function triggered with onClick() before it was checking to see if the associated link should be disabled, where as all other browsers were doing it the other way around. I found very little on it, but what I did find suggested that it was away for MS to try and speed IE8 up (can't use IE9 as this is a work project, and we do not have IE9 compatible machines).

    Bottom line - I have it working now, by changing one on line in my JS function that was fired by onClick(). This -

    document.getElementById('attachment-body').innerHTML = '';

    Became this -

    document.getElementById('attachment-body').style.display = 'none';

    Thanks.

  4. Marventus
    Member
    Posted 2 years ago #

    Glad to know you figured it out.
    Good luck on your project!

  5. Marventus
    Member
    Posted 2 years ago #

    Hi,

    Could you please mark this thread as resolved?

    Thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.