1

my Javascript (jQuery) is working fine in newer browsers (Chrome, Firefox, safari 10+) but not in slightly older Browers (Safari 9, IE 11..).

It however does work fine, when I include it directly on the page and dont try to load it from an external file. I have been at it for hours and I cant figure out what the problem is..

My Javascript:

$( document ).ready(function($) {


  $(".monatsInput").on("click", function () {
    console.log("clicked");

    $(".monatsWahl").css("border-color", "lightgrey")
    $(this).parent().css("border-color", "#4CA3D8");

    var newPrice = $(this).val();
    $(this).parent().parent().parent().parent().find(".angebotsPreis").html(newPrice);
  })


// Mobile Nav
// --------------------------------------------------
// --------------------------------------------------

$("#burgerNav").on("click", function () {
  $(".navList").toggle("display");
});


// Back to previous page
  function goBack() {
      window.history.back();
  }


$(document).foundation();
})

Im not sure which part of the HTML to include, so the entire page can be viewed here:

www.immobilienheld24.de

I hope someone has an idea.

Thanks

Miron
  • 11
  • 2
  • Just a suggestion, if you have so little Javascript on the page, you would be better off having it within the HTML as inline element. – Nisarg Shah Aug 02 '17 at 15:47
  • even if it has to be included on every page? Which the Mobile-nav part what be – Miron Aug 02 '17 at 15:48
  • If you have to include it in every page, then **better** to have it as an external file. – Hari Harker Aug 02 '17 at 15:50
  • 2
    can you expand upon the `but not in older browsers` issue? what does the console output? – Surreal Aug 02 '17 at 15:53
  • Have you read this ? https://stackoverflow.com/questions/25077612/jquery-not-working-with-ie-11 – Hari Harker Aug 02 '17 at 15:58
  • I will try that, but its not just an IE problem. Safari 9 isnt working either. – Miron Aug 02 '17 at 16:00
  • You can add console.log in js to make sure that this code runs. My guess is that you get error BEFORE this code in js. – Proggear Aug 02 '17 at 16:01
  • Ive tried that :/ As said before - the code works finde, when its inline. And it works fine in some browsers. – Miron Aug 02 '17 at 16:05
  • SyntaxError: Invalid character: '`' in app.js:10208. Replace this chars with single or double brackets (' or ") – Proggear Aug 02 '17 at 16:05
  • thats not part of my JS - so Im assuming its part of the jQuery library.. maybe.. if commented out the Foundation JS, so I dont know what else it would be – Miron Aug 02 '17 at 16:23

0 Answers0