Fallback code automatically runs when tested in Microsoft Edge

Fallback code automatically runs when tested in Microsoft Edge
0

#1

So when testing my site in chrome the site is displayed and runs the way i intended it to look/run but when tested in Microsoft Edge my fallback code for bootstrap automatically runs for some reason my .JS code looks like this

  if ($('#bootstrapCssTest').is(':visible')) {
    $('head').prepend('<link rel="stylesheet" href="assets/css/bootstrap/dist/css/bootstrap.min.css">');
    $('#bootstrapCssTest').insertAfter('<script src="assets/css/bootstrap/dist/js/bootstrap.bundle.min.js"><\/script>');
  }

I have my div class just before my first cdn script tags which looks like this

<div id="bootstrapCssTest" class="hidden"></div>

If anyone can shed some light on this issue on why my code for some reason is being ran in Microsoft Edge, but not in chrome ,when i believe it should only run if the bootstrap cdn failed to load. Thank you guys.


#2

What does hidden apply to the element? If it literally applies visibility: hidden then the element will still take up space on the page, so will not be classified invisible, and that code block will always run: https://api.jquery.com/visible-selector/