Will
Will

Reputation: 3044

JavaScript incompatibilities issues with IE8

I am using jQuery as well as twitter bootstrap for my site. I am using a scroll spy, A carousel and an AJAX form submit. I have tested these in three browsers. They work in chrome and FF but not in internet explorer.

Im new to the technologies so I may have missed something important for compatibility Below are the scripts im using.

<script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script>
<script src="js/bootstrap.js"></script>
<script src="js/parsley.js"></script>



<!-- script to make the navigation scroll -->
<script>

    var $root = $('html, body');

    $('#nav a').click(function() {
        var href = $.attr(this, 'href');
        $root.animate({
            scrollTop: $(href).offset().top
        }, 500, function () {
            window.location.hash = href;
        });
        return false;

    });

</script>

  <script>

          // AJAX submit
          $("#emailForm").submit(function() {

            var url = "email.php"; 

            $.ajax({
                   type: "POST",
                   url: url,
                   data: $("#emailForm").serialize(),
                   success: function(data)
                   {
                       $('#emailForm')[0].reset();
                       $('#contactForm').prepend('<h1 class="text-success" id="messageSent">Message sent!</h1>');
                       $("#messageSent").fadeIn("slow");
                       window.location.href = '#contact';
                   }
                 });

            return false; // avoid to execute the actual submit of the form.
        });

</script>

<!-- script to make the carousel work  -->
<script>

      // carousel demo
      $('#myCarousel').carousel();

</script> 

Could someone possibly point out/ explain the errors of my ways

EDIT: I am using IE 8 to test this in.

Upvotes: 1

Views: 3084

Answers (1)

JAM
JAM

Reputation: 6205

<script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script>

You are using version 2.0.0 of jQuery, which won't work in IE 8. You can read about this here.

I suggest you use a version of jQuery that's compatible with the lower IE versions, for example 1.9.1:

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>

Upvotes: 2

Related Questions