Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.

Only jquery console.log statement is not working in AEM. Other lines of code executes well. Is there a way to debug this issue?

Avatar

Level 1

Is there a way to debug the following code where the line for the console.log doesn't log the message "Test message" in console? But the next line alert("Test Alert") works fine.

 

$(document).ready(function() {

         console.log("Test message");

         alert("Test Alert");

});

 

I have tried changing the version of the jquery CDN link to the previous versions and am still facing the same issue.

 

3 Replies

Avatar

Level 1

Hi @anishtimila11 

 

The above code snippet should work as expected. If the jquery library is loaded console.log will print the statement. 

 

Try to debug from the developer console in chrome and check the statement is passing through. If there's any error please post the screenshot

 

Hope this helps

 

Thanks

 

Avatar

Level 4

Hi @anishtimila11 ,

as @PRATHYUSHA_VP mentioned below you shall try pudding a debug point in the browser console (F12) and debug your JS file, 

FYI -

Screenshot 2024-10-28 at 07.25.09.png

 

Thanks,

Raju.

Avatar

Level 2

Hi @anishtimila11 

 

There is a chance that somewhere in your code, maybe another clientlib, to have a line like the one below, that disables all console.log outputs:

 

console.log = function() {}

 

Worth checking this out as well.