0

I have a really simple HTML page and a jQuery script. It works perfectly in Chrome, but when I run it in IE11 it just doesn't execute the jQuery script. There's no error in the console, and in Debug mode I can't go into the jQuery script. I'm using Windows XP and IE11.

If you need more details don't hesitate to ask me.

<header>
  <h1>ENVIRONMENTS STATUS</h1>
</header>
<script src="js/jquery-3.4.1.min.js"></script>
$(document).ready(function() {
  var obj;
  $.getJSON("data/data.json", function(data, index) {
    var id = 0;
    data.sort(function comparePriority(a, b) {
      return b["status"] - a["status"];
    })
    jQuery.each(data, function(index, element) {
      CreateNewStatus

      Div(element, id);
      id++;
    });
  })
});

function CreateNewStatusDiv(obj, id) {
  $('body').append('<div class="MainDiv" id="' + id + '">');
  $('#' + id).append('<div class="FirstDiv" id="firstDiv' + id + '">');
  CreateStatusIndicator(obj["status"], id);
  $('#firstDiv' + id).append('<div class="desc">' + obj["description"] + '</div>');
  $('#firstDiv' + id).append('<img class="btnRotate" id="Img' + id + '" src=""/>');

  CreateBtnExpandDetails(id);
  CreateDetailsDiv(id, obj);
}

function CreateDetailsDiv(id, obj) {
  $('#' + id).append('<div id="details' + id + '" class="details">' + obj["details"] + '</div>');
  $('#details' + id).hide();
}

function CreateStatusIndicator(status, id) {
  switch (status) {
    case 0:
      $('#firstDiv' + id).append('<div class="circle" id="green">');
      break;
    case 1:
      $('#firstDiv' + id).append('<div class="circle" id="orange">');
      break;
    case 2:
      $('#firstDiv' + id).append('<div class="circle" id="red">');
      break;
  }
}

function CreateBtnExpandDetails(id) {
  $('#firstDiv' + id).click(function() {
    if ($('#details' + id).is(":visible")) {
      $('#details' + id).hide(100);

    } else {
      $('#details' + id).show(100);
      $('#Img' + id).addClass('down');
    }
  });
}
Rory McCrossan
  • 306,214
  • 37
  • 269
  • 303
Axel
  • 145
  • 9
  • 2
    You have syntax errors. May you fix them first? – evolutionxbox Feb 05 '20 at 09:49
  • 1
    I can't imagine the whitespace in the call to `CreateNewStatus Div` would work anywhere? Add some `console.log` calls to see which parts of your code is entered. Check the network tab, does the call to data/data.json get executed? Does it return what you expect? – David Hedlund Feb 05 '20 at 09:50
  • Also: does jQuery itself get downloaded? – mbojko Feb 05 '20 at 09:55
  • You could try to check the paths of jquery file and javascript file are right or not. As I use `https://code.jquery.com/jquery-3.4.1.min.js` and put the javascript as inline script, it can go into the script. Please use F12 dev tool network tab to see if all the files are loaded. You can also add breakpoints into the script to debug it. – Yu Zhou Feb 06 '20 at 02:21

0 Answers0