jQuery script works in Firefox but not in IE. Why am I not surprised?

Posted by Ben Tew on Stack Overflow See other posts from Stack Overflow or by Ben Tew
Published on 2010-03-12T21:02:22Z Indexed on 2010/03/12 21:07 UTC
Read the original article Hit count: 189

Filed under:

I'm working with the context of a CMS system and trying to turn seperate div's into tabs. You can see it at http://www.wtvynews4.com/test I've kludged together some code from a tutorial site.

<script charset="utf-8" type="text/javascript">
jQuery(function() {

//When page loads...
$("div[ondblclick$='87119417']").attr("id", "87119417");
$("div[ondblclick$='87119482']").attr("id", "87119482");
$("div[ondblclick$='87119672']").attr("id", "87119672");
$("div[ondblclick$='87119727']").attr("id", "87119727");
$("div[ondblclick$='87119812']").attr("id", "87119812");
$("div[ondblclick$='87119417']").addClass("tab_content");
$("div[ondblclick$='87119482']").addClass("tab_content");
$("div[ondblclick$='87119672']").addClass("tab_content");
$("div[ondblclick$='87119727']").addClass("tab_content");
$("div[ondblclick$='87119812']").addClass("tab_content");

$(".tab_content").hide(); //Hide all content
$("ul.morenewstabs li:first").addClass("active").show(); //Activate first tab
$(".tab_content:first").show(); //Show first tab content

//On Click Event
$("ul.morenewstabs li").click(function() {

    $("ul.morenewstabs li").removeClass("active"); //Remove any "active" class
    $(this).addClass("active"); //Add "active" class to selected tab
    $(".tab_content").hide(); //Hide all tab content

    var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
    $(activeTab).show(); //Fade in the active ID content
    return false;
});

});
</script>

Everything works fine in Firefox but not IE. can you provide any assistance? When the page loads the attribute ID's and classes aren't assigned. I tried changing jQuery(function() { to $(document).ready(function() still no luck.

© Stack Overflow or respective owner

Related posts about jQuery