Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

debug JS code which triggers an alert()

I have a system which is built using the ext-js library. Part of the system lists orders that are flowing through an online store. When a row is clicked, additional order details are shown. A few days back, a message saying "FIXME: created panelID..." began to appear as soon as a row is clicked. After that, normal functioning continues, i.e. the error message is just annoying and doesn't break normal execution after it appears.

I am trying to debug the JS code to see under what circumstances does the error message appear, i.e. why did it suddenly start appearing. I am trying to do this with FireBug. Does anyone have any tips I could use to achieve my goal of establishing what line of code triggers the alert()? Any input on the matter is much appreciated.

like image 897
Boyan Georgiev Avatar asked Sep 03 '10 17:09

Boyan Georgiev


People also ask

Which object has alert () method in JavaScript?

The JavaScript alert() function is a function available on the global window object. It commands the browser to display a modal dialog with a message and an "OK" button.

What does the alert () function in JavaScript do?

The alert() method displays an alert box with a message and an OK button. The alert() method is used when you want information to come through to the user.

How will you generate an alert in JavaScript?

The alert() method in JavaScript displays an alert box with a specified message and an OK button. It is often used to make sure that information comes through to the user. The alert box takes the focus away from the current window and forces the browser to read the message.


1 Answers

Here's more cross-browser version of @chetan's answer

        window.alert_ = window.alert;
        window.alert = function () {
            debugger;
            alert_.apply(window, arguments);
        };
like image 148
Alexander Puchkov Avatar answered Sep 23 '22 19:09

Alexander Puchkov