Monday, May 13, 2024
 Popular · Latest · Hot · Upcoming
78
rated 0 times [  82] [ 4]  / answers: 1 / hits: 9269  / 10 Years ago, tue, december 23, 2014, 12:00:00

I want to know which Dom event is fired when alert message is called. I want to call start_tracking method when alert message is called. I am able to call methods on page resize but how can i know which method is called when the alert message is fired.



win.addEventListener(click, function(event) {
start_tracking ();
});


Click event is working when i am clicking anywhere on the page but when i click the alert message content then it does not fire the click listener. Nothing seems to be fired on the alert() function.


More From » jquery

 Answers
1

It is not possible to capture any alert() function events. I don't know why you would want to do that, but I would create another function instead called warn().





function warn(warning) {

alert(warning);
capturedAlert();

}

function capturedAlert() {

alert('An alert was called.');

}

<button onclick=warn('This is a warning!')>Warn!</button>





This way, every time warn() is called, you can alert() the user, AND call another function.


[#40451] Sunday, December 21, 2014, 10 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
joanneamiyaa

Total Points: 532
Total Questions: 127
Total Answers: 98

Location: Guam
Member since Tue, Nov 3, 2020
4 Years ago
;