The tab navigation feature is experiencing issues in Internet Explorer versions 7 and 8

I have successfully implemented a tab menu that functions well in Chrome and IE 9,10. However, it does not seem to work in IE 7 or 8. I am at a loss regarding what changes need to be made to my code.

Could anyone provide assistance?

Link to Code Example

<ul class="hr_tab menu1">  
  <li class="tab1 on" data-tab="tab-1" data-trigger-class="menu1">  
     <a href="#">tab1</a>
  </li>
  <li class="tab2" data-tab="tab-2" data-trigger-class="menu2">
     <a href="#">tab2</a>
  </li>
  <li class="tab3" data-tab="tab-3" data-trigger-class="menu3">
     <a href="#">tab3</a>
  </li>
</ul>


<div id="tab-1" class="tab_content on">111</div>
<div id="tab-2" class="tab_content">22</div>
<div id="tab-3" class="tab_content">33</div>

.tab_content { display:none; }
.tab_content.on { display:inherit;}


$(document).ready(function(){
  $('ul.hr_tab li').click(function(e){
    var tab_id = $(this).attr('data-tab');
    $('ul.hr_tab li').removeClass('on');
    $('.tab_content').removeClass('on');
    $(this).addClass('on');
    $("#"+tab_id).addClass('on');
    $('.hr_tab').removeClass('menu1 menu2 menu3');
    $('.hr_tab').addClass($(this).attr('data-trigger-class'));
    e.preventDefault();
  });
})

Answer №1

If you have not already added it, consider inserting the following code in the HTML head section:

<meta http-equiv="X-UA-Compatible" content="IE=edge">

This will prompt IE to display as if it is the most recent version (Learn more about what <meta http-equiv="X-UA-Compatible" content="IE=edge"> does)

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Is there a way to efficiently add delimiters to an array using jquery dynamically?

Just joined this community and still figuring things out. I have a question - how can I use jQuery to dynamically add a delimiter like "|" after every 3 elements in an array? This way, I can explode the array and utilize the resulting arrays separately. He ...

The svh/lvh units are experiencing unexpected issues when using Chrome on an iPhone

I'm facing an issue with my hero section that is supposed to take up the full height of the viewport. I recently tried using the new svh/lvh units, which seemed to work fine on desktop and Safari for mobile. However, when testing on Chrome for mobile ...

Enlarge an image when hovering over it

I am currently in the process of creating a website and I have encountered an issue. When I hover over an image, I want it to zoom in, but unfortunately it does not zoom within the designated div area. How can I fix this problem? <div class="container" ...

The event resizing feature in fullCalendar2.6* seems to be experiencing some issues

After updating from fullCalendar 1.6 to 2.6, all functionality seems to be working except for eventResize. In the newer version, I am unable to see the resize arrow when attempting to adjust events, although it was functioning properly in the previous ver ...

Performing mathematical calculations using javascript

In my project, I'm utilizing HTML, CSS, and JavaScript to achieve the following: Dropdown menu for Category (Coffee Appliance) Dropdown menu for Product (Keurig Coffee Maker) Wattage: 1500kWh (auto-filled from Local Storage) Daily Energy Con ...

Differences in Print Layout Between Chrome and Firefox when Viewing a PHP Website

I have been working on creating a print command to print a specific div, and I have managed to successfully run the print command using default methods like CTRL + P and also with a button click. The Issue: However, I have encountered a problem where the ...

What could be causing my div element to not inherit its parent div's width?

My query revolves around a header div that I'm struggling to align with the same width as its parent div, while keeping the content centered. Currently, the div is only as wide as its content, causing it to be off-center. https://i.stack.imgur.com/E1 ...

Troubleshooting Problem with Accordion Size in CSS

I am facing an issue with a dropdown menu that I have created. The dropdown has parent and child rows to display controls, but the width of the Accordion is not stretching as expected despite being set to 100%. Using Chrome and Edge developer tools, I insp ...

How come the inclusion of a DOCTYPE tag impacts the styling of my CSS?

I am puzzled why the code below renders correctly without any issues until I add a doctype declaration: <body style="margin:0; padding:0; background-color:#eeeeee"></body> <div id="HeaderContainer" style="background-color:#eeeeee; color:Bl ...

What is the process for reducing the value displayed on the label?

I have three labels and I would like to subtract the value of two labels and place the result in the third label. $(document).ready(function() { //Retrieve the values from both labels var value1 = document.getElementById("addition").innerText; ...

experimenting with adding fresh choices to dropdown menu using ajax and jquery

When attempting to load a list of locations through ajax/jQuery, I encounter an issue. After typing a letter into the input field, the first response is displayed but subsequent responses are simply appended to it. I have tried using .html('') an ...

Looking to showcase duplicate ranks that have been selected, and specifically identify which ranks are being duplicated using JavaScript/jQuery

In this section, we have implemented the logic to identify duplicate ranks. However, in addition to displaying which ranks are duplicated, I also aim to highlight the specific rank that is being duplicated within the range of 0 to 18. function validate( ...

Guide to ensuring a jQuery modal box appears above other page elements

As I work on a jQuery popup modal box, I am faced with the issue of it pushing all other content aside when called. The toggleSlide() function is being used and works fine, but the layout problem remains. Attempts to rectify this by using position: relati ...

Export data from tables into an Excel spreadsheet using ReactJS

I need to export multiple tables from my webpage into a single Excel sheet. <div>{store.ratecardList.map(ratecard => { return( <div key={ratecard.ratecardId} className="box-filter"> <table id={ratecard.ratecardId} widt ...

Leverage the power of Laravel8 to simultaneously update two tables in one go

In my database, I currently have two tables: https://i.stack.imgur.com/TObcy.jpg https://i.stack.imgur.com/U6IhT.jpg The form that I am working with is shown below: <form id="contratform" method="post" action="contrats" ...

Retain the contents of the shopping cart even when the page is refreshed

For a course project, I am recreating a grocery store website and need assistance on how to retain the shopping cart values even after refreshing the webpage. Please inform me if more information is required... <button type="button" id= ...

Turn on and off scrolling of DIV content when hovering over it

How can I create a div that automatically scrolls to the bottom on hover? I tried implementing the code below, but it doesn't work as expected. It jumps to the bottom of the div's height on first hover and transitions smoothly on second hover. . ...

What could be causing my website to automatically adjust the CSS height on its own?

My code looks like this: <li style = "height: 250px;"> <p>Foo</p></li> Despite my efforts, when I visit the website, the height doesn't seem to change. After inspecting the element in Chrome, I discovered that it's s ...

Beginner in html, css, and javascript: "Tips for saving jsfiddle demos?"

Recently, I developed an interest in JavaScript and CSS and came across some impressive examples on jsfiddle. I was wondering if there is a way to "export" these examples to my computer. Simply copying and pasting doesn't seem to work. How can I modi ...

Develop a dynamic animation using gradient and opacity properties

I'm still getting the hang of HTML, JavaScript, and CSS but I recently made some changes to someone else's code to animate a gradient. The original code used background: rgb, but I switched it to background: rgba. It seems to be working fine, but ...