tags:

views:

60

answers:

2

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.

A: 

From a very quick search, it might be something to do with the charset attribute to your script tag. Try removing it and see if that helps. If it does, and you need UTF-8 support, there are other options.

Blair McMillan
Still works in Firefox...not in IE
Ben Tew
Strip it down to one item only, and remove all of your onclick stuff. Take it right back to just adding a class. Then add one line at a time until you see which line doesn't work, then we can go from there.
Blair McMillan
A: 

I figured it out. IE searches attributes case-sensitive. Plus it appears not to recognize [attrib$="value"] selectors. Instead I had to use [attrib*="value"] Thanks for everyone's help.

Ben Tew