1

I have problems with Ie 9 and Jquery. I thought the newest Jquery is compatible with Ie 9 but some default functions does not work in IE 9. Does anybody had the same problems and know how to solve it. The folowing triggers does work in IE 10 but not in IE 9:

$('.uitklappen').click(function(event){

$('.leermiddel_check').on('click',function(event){

Thanks!

Full code:

$(document).ready(function() {

// FUNCTIES

  // De romein wat laten zeggen
  function romein(zin){
    $('.spreekwolkje').html(zin);     
  }

 // functie voor ophalen van levels of domeinen
 function getObjects(){

    var type = $('.keuze option:checked').text();
    $('.objecten').empty();
    $('.progress').css('display','');
    $.ajax({type: "POST",async:false,url: base_url+"aanhetwerk/get/"+type+"/",
        success: 
        function(data){
          $.each($.parseJSON(data), function(i,item)
          {
             $('.objecten').append('<option value="'+item.id+'">'+item.naam+'</option>');                 
          });
          $('.progress').css('display','none');             
    }});            

    if ($(".object_keuze").length > 0){
        $('select[name=objecten] option[value='+$(".object_keuze").val()+']').attr('selected', 'selected');
    }   
 }        


// Functie om de kop selectie op te slaan en door te laden
function saveKoppen(){

    // Doorloop alle gecheckte koppen
    var array = new Array(); var count = 0;
    $('#filter').find('.check_kop').each(function( index ) {
        if($(this).prop('checked') == true){
            array[count] = $(this).attr('id');
            count++;
        }
    });

    $.ajax({type: "POST",
            async:true,
            url: base_url+"aanhetwerk/opslaankoppen/",
            data:{koppen:array}
    });
}

// Functie om onderdelen te hiden
function hideOnderdelen(){
    $('#filter').find('.check_kop').each(function( index ) {
        var id = $(this).attr('id');
        if($(this).prop('checked') == false){               
            $('.kop_block[id='+id+']').hide();
        }else{
            $('.kop_block[id='+id+']').show();
        }
    });
}

// UITVOEREN BIJ TRIGGER
  // Uitklappen van leermiddelen
  $('.uitklappen').click(function(event){
    console.log($(this).closest('div'));
    if($(this).closest('tr').find('table').is(":visible")){
        $(this).closest('tr').find('table').hide();
        $(this).find('img').attr('src',base_url+'external/images/icoontjes/FatCow_Icons16x16/toggle_expand.png');   
    }else{
        $(this).closest('tr').find('table').show();
        $(this).find('img').attr('src',base_url+'external/images/icoontjes/FatCow_Icons16x16/toggle.png');                  
    }
    event.preventDefault();
  });

  // Leerdoel checken en unchecken
  $('.leerdoel_check').on('click',function(event){
    var leerdoel_id = $(this).attr('id');

    if($(this).hasClass('unchecked')){

        var d = new Date();
        var month = d.getMonth()+1;
        var day = d.getDate();
        var year = d.getFullYear();
        var minutes = d.getMinutes();
        var hours = d.getUTCHours();

        $(this).closest('tr').find('td:eq(1)').html(day+'-'+month+'-'+year+' '+hours+':'+minutes);

        $(this).removeClass('unchecked').addClass('checked');
        $.ajax({type: "POST",url: base_url+"aanhetwerk/checkLeerdoel/"+leerdoel_id+"/1/"});   

        // Melding geven aan Romein
        var min = 0; var max = 7;           
        var random = Math.floor(Math.random() * (max - min + 1)) + min;
        if(random == 0){ romein('');}
        if(random == 1){ romein('Weer wat geleerd. Ga zo door.');}
        if(random == 2){ romein('Ik ben trots op je!');}
        if(random == 3){ romein('Ja, ja alweer een nieuw leerdoel afgevinkt.');}
        if(random == 4){ romein('Aaah hier word ik blij van. ');}
        if(random == 5){ romein('');}   
        if(random == 6){ romein('Ik zal eens een leuke mop vertellen: ""WOW jij bent lang, je doet vast aan basketbal!" "WOW jij bent klein, je doet vast aan minigolf?""');}
        if(random == 7){ romein('Nu verdien jij een leuke mop: "Ben je sportief?" "Ja! Ik surf..... Op internet!" HAHAHAH');}

    }else{
        $(this).closest('tr').find('td:eq(1)').html('');
        $(this).removeClass('checked').addClass('unchecked');
        $.ajax({type: "POST",url: base_url+"aanhetwerk/checkLeerdoel/"+leerdoel_id+"/0/"});   
    }

    event.preventDefault();
  });

  // Leermiddel checken en unchecken
  $('.leermiddel_check').on('click',function(event){
    var leermiddel_id = $(this).attr('id');
    if($(this).hasClass('unchecked-l')){
        $(this).removeClass('unchecked-l').addClass('checked-l');
        $.ajax({type: "POST",url: base_url+"aanhetwerk/checkLeermiddel/"+leermiddel_id+"/1/"});     
    }else{
        $(this).removeClass('checked-l').addClass('unchecked-l');
        $.ajax({type: "POST",url: base_url+"aanhetwerk/checkLeermiddel/"+leermiddel_id+"/0/"});  
    }
    event.preventDefault();
  });             

  // Expert modus aan of uit
  $('.expertbutton').on('click',function(event){
    var leerdoel_id = $(this).attr('id');
    if($(this).hasClass('non-expert')){
        $(this).removeClass('non-expert').addClass('expert');
        $.ajax({type: "POST",url: base_url+"aanhetwerk/setExpert/"+leerdoel_id+"/1/"});
        // Melding geven aan Romein
        var min = 0; var max = 3;           
        var random = Math.floor(Math.random() * (max - min + 1)) + min;
        if(random == 0){ romein('Jij bent een echte topper!');}
        if(random == 1){ romein('');}
        if(random == 2){ romein('Wat fijn dat je anderen wilt helpen');}
    }else{
        $(this).removeClass('expert').addClass('non-expert');
        $.ajax({type: "POST",url: base_url+"aanhetwerk/setExpert/"+leerdoel_id+"/0/"});
    }
    event.preventDefault();
  });   

// Expert modus aan of uit
$('.expert').change(function(event){
    var value = $(this).val();
    $.ajax({type: "POST",url: base_url+"aanhetwerk/expertModusOn/"+value+"/"});   
    event.preventDefault();     
}); 

$( "#dialog" ).dialog();
$( "#dialog" ).dialog('close');
// Open expert scherm
$('.experts').click(function(event){
    $(this).next('.laden').show();
    $('#dialog ul').empty();
    var leerdoel_id = $(this).attr('id');
        $.ajax({
            type: "POST",
            async:false,
            url: base_url+"aanhetwerk/getExperts/"+leerdoel_id+"/",
            success: function (data) {
                $.each($.parseJSON(data), function(i,item){
                    $('#dialog ul').append('<li><a class="user-icon"></a>'+item.naam+'</li>');
                });
            }           
        });  
    $( "#dialog" ).dialog('open');
    $(this).next('.laden').hide();
    event.preventDefault();
});

// Selecteer de option die voor de post was ingevoerd
if ($(".type_keuze").length > 0){
    $('select[name=type] option[value='+$(".type_keuze").val()+']').attr('selected', 'selected');
}

// FUNCTIES UITVOEREN
getObjects();
hideOnderdelen();

$("html, body").animate({ scrollTop: 0 }, "slow");  

// Aan het uitvinken van koppen
$('#aanhetwerk_content').on('click','.check_kop',function(){
    hideOnderdelen();   
    saveKoppen();       
});

// Bij wijzigen van de keuze objecten ophalen
$('.keuze').change(function(){
    getObjects();
}); 

});

7
  • what version is your "newest jQuery"? Sep 2, 2013 at 9:12
  • test this, change function(event) to function(e) Sep 2, 2013 at 9:12
  • In what way doesn't it work? Do you get errors in the Javascript console?
    – Barmar
    Sep 2, 2013 at 9:15
  • please post your ful code , you may have another error inside page Sep 2, 2013 at 9:27
  • 1
    take a look if you have any "console.log" statements in your code, execution in ie9 witout having developer toolbar open is not possible otherwise in many cases
    – john Smith
    Sep 2, 2013 at 9:56

1 Answer 1

1

jQuery 2 does not support Internet Explorer 6-8. If you must have support for IE, use v1.9 or lower.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.