简体   繁体   中英

jquery not working in IE after ajax call

I am using organictabs plugin, which I initiate in every page load in this form:

    $(function() {
        $("#example-one").organicTabs();

        $("#example-two").organicTabs({
            "speed": 200
        });    
    });

The tabs work fine in all browsers, and then I perform an ajax call which regenerates the tabs with the following code:

if(xmlHttp.readyState == 4)
{
  HandleResponse(xmlHttp.responseText,'page-wrap');

  $(function() {
        $("#example-two").organicTabs({
            "speed": 200                
        });                   

  });
}

Again, the tabs are regenerated properly and everything works fine in all browsers EXCEPT in IE, when I try to switch tabs it doesn't work. I am initiating the jquery code onreadystate change, and i really can't figure out what can the problem be with IE?

Any help will be greatly appreciated.

All the best

The problem was with how IE handles the ("a.sample_class").attr("href") attribute. In Chrome/FF the relative path is returned(in this case just the anchor #tag), whereas in IE, after I was calling an ajax page, the absolute path was being returned(http://www.mysite.com/#tag), hence trying to find the entire anchor(string) in the current page.

More information regarding this issue you can read in this article: http://www.glennjones.net/2006/02/getattribute-href-bug/

Hope this is of help to someone, as it really took a few days of my time

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM