CaitlinHavener
CaitlinHavener

Reputation: 1418

Jquery not working on IE 7,8

Why doesn't the javascript work here: http://kodiakgroup.com/customers.html on IE 7 and 8 specifically?? Errors on the first dollar sign for Jquery: Object doesn't support this property or method.

Entire code:

    <!--[if IE]>
        <link rel="stylesheet" type="text/css" href="/css/ie.css" media="screen" />
        <script src="js/json2.js"></script>
    <![endif]-->

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


    <script type="text/javascript">
    $(function () {
        $('#vertical-filters input').attr('checked', true);//Set checkboxes as checked by default
        getCustomers(); //Initially call all customers

        function getCustomers()
        {   
            $('ul#customers').html('');//empty list
            var definedCategoryArray=new Array();

            for(var x=0; x< $('#vertical-filters li input').length; x++){
                var thisItem=$('#vertical-filters li input')[x];
                var thisItemName=$(thisItem).attr('id');
                if ($(thisItem).is(':checked'))
                    definedCategoryArray[thisItemName]=true;
                else
                    definedCategoryArray[thisItemName]=false;
            }

            $.getJSON('customers.json', function(data) {
                for(var index in definedCategoryArray){ //cycle through categories array
                    console.log(index + ':' + definedCategoryArray[index]);
                    for(var i=0; i<data.customers.length; i++){ //cycle through json data
                        if (definedCategoryArray[index]==true){//if the value in the array is true (item checked)
                                if(data.customers[i].category == index) //match category (from definedCategoryArray index) to items in json object to parse
                                    $('ul#customers').append('<li class="customerListItems"><a href="'+ data.customers[i].link +'"><img src="'+ data.customers[i].imageLink +'" alt="'+ data.customers[i].customerName +'" /></a></li>');
                        }
                    }
                }
            }).fail(function() { console.log( "error" ); });
        }

        //Toggle select all/deselect function
        $('.selectAllBoxes').unbind('click').bind('click', function (e) {
                e.preventDefault();
                var checkBoxes = $('#vertical-filters input');
                checkBoxes.prop("checked", !checkBoxes.prop("checked"));
                getCustomers();
        });

        //Check box checked function
        $('#vertical-filters input').change(function(){
            getCustomers();
        });


    }); 
    </script>
</head>

Upvotes: 1

Views: 2429

Answers (1)

Vivin Paliath
Vivin Paliath

Reputation: 95508

jQuery 2.0 has dropped support for IE versions 6, 7, and 8 and will not work. From the release notes:

No more support for IE 6/7/8: Remember that this can also affect IE9 and even IE10 if they are used in their “Compatibility View” modes that emulate older versions. To prevent these newer IE versions from slipping back into prehistoric modes, we suggest you always use an X-UA-Compatible tag or HTTP header. If you can use the HTTP header it is slightly better for performance because it avoids a potential browser parser restart.

Source: jQuery 2.0 Released.

You can try using 1.9 instead.

Upvotes: 4

Related Questions