jQuery Code Only Runs When Firebug is Open
Share
So you may be wondering why your jQuery Code is only running when firebug is open on your browser. Well, this could be because you have used console.log commands in your code and the jQuery code is failing because the console doesn’t exist.
To fix this simple put your console.log and firebug commands inside the following code:
if (window.console) {
console.log(text);
}
Ensure no JavaScript errors are thrown for browsers without Firebug installed
if (!window.console || !console.firebug)
{
var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml",
"group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"];
window.console = {};
for (var i = 0; i Turn it into a debug function sir?
[js]
function debug(text) {
if ((typeof(Debug) !== 'undefined') && Debug.writeln) {
Debug.writeln(text);
}
if (window.console && window.console.log) {
window.console.log(text);
}
if (window.opera) {
window.opera.postError(text);
}
if (window.debugService) {
window.debugService.trace(text);
}
}
If console available, log the error
if (typeof(console) != 'undefined' && typeof(console.log) == 'function') {
// If console available, log the error.
console.log('Problem hiding the form', e);
}