I made this jQuery script for selecting a color in proces that I made. Now I am testing my script in IE8 and I cannot select colors there anymore.
IE gave me an error that says: 'console is undefined'.
It says the problem is on line 101 in my script and that's this line:
console.log(num);
I founded other articles on stackoverflow (for example this one: 'console' is undefined error for Internet Explorer) that describing and fixing this problem, but I cannot get it work.
Can someone help me with this?
My script:
// Custom Select box
enableSelectBoxes();
// Custom select box function
function enableSelectBoxes(){
$('div#color_scheme').each(function(){
if($(this).children('span.selected').html() == '')
$(this).children('span.selected').html($(this).children('div#colors').children('div#colors span:first').html());
$(this).find('#colors span').click(function() {
var num = $(this).data('selnum');
if (!num) {
num = $.trim($(this).html());
console.log(num);
$(this).data('selnum', num);
}
var oldSel = $('#colors span.selected_color');
oldSel.removeClass('selected_color').empty().html(oldSel.data('selnum'));
//remember the bg color
var bgColor = $(this).css('background');
if($(this).hasClass('color_none')) {
$(this).addClass('selected_color').html(
num + '<div class="this_color"><div class="color_example">Color value</div><input type="submit" name="submit_color" value="Selecteer"/></div>');
}
else {
$(this).addClass('selected_color').html(
num + '<div class="this_color"><div class="color_example">Color value</div><input type="submit" name="submit_color" value="Selecteer kleur"/></div>');
}
$('[name=submit_color]').click(function(e) { e.stopPropagation(); });
$(".color_example").html($(this).attr('value'));
//set the bgColor
$(".color_example").css({
background : bgColor
});
$("#color_field").attr('value',$(this).attr('value'));
});
});
}