JQuery document ready function not working in IE
domdocument, internet-explorer, jquery
Solution
console is not defined in IE9 modify your code like
jQuery(document).ready(function() {
jQuery('td.register').each(function () {
var text = jQuery(this).text();
var exploded = text.split(',');
if(typeof(console)!='undefined'){
console.log(exploded[0]);
console.log(exploded[1]);
}
if (exploded[0] == 0) {
jQuery(this).html("<font color='red'>SOLD OUT</font>");
} else {
jQuery(this).html("<a class='button' title ='Register for this event' href='" + exploded[1] + "'>Register</a>");
}
})
});
Problem
I have a function I'm using to replace some text output with a button or sold out label accordingly. ``` jQuery(document).ready(function() { jQuery('td.register').each(function () { var text = jQuery(this).text(); var exploded = text.split(','); console.log(exploded[0]); console.log(exploded[1]); if (exploded[0] == 0) { jQuery(this).html("<font color='red'>SOLD OUT</font>"); } else { jQuery(this).html("<a class='button' title ='Register for this event' href='" + exploded[1] + "'>Register</a>"); } }) }); ``` It seems to work fine on most browsers, but the client is complaining in IE9 it's not working. When I test it on my computer, most of the time it works, but sometimes it doesn't, and every time I test it on browsershots.org it doesn't work. It shows up in browsershots.org tests as if the jQuery didn't even run.