Solved

How do I create an event handler for jQuery Migrate warnings?

Posted on 2014-10-28
2
241 Views
Last Modified: 2014-10-29
Hi jQuery experts!

I'd like to wire up error logging for when jQuery Migrate warnings come up. Is it possible to handle this event? If so, can you provide a basic example of how to create this event handler?

Thanks!
0
Comment
Question by:Drevo
2 Comments
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 total points
ID: 40410408
check here : https://github.com/jquery/jquery-migrate/blob/master/src/migrate.js
see line 32:
console.warn( "JQMIGRATE: " + msg );

Open in new window

just add the following line after/before :
$(document).trigger("migrateWarn", [msg]);

Open in new window


and in your code, to be notified :
$(document).on("migrateWarn", function( event, arg1) { // http://api.jquery.com/on/ since jQuery 1.7
     alert("got it : " + arg1);
});

Open in new window


more infos :
http://learn.jquery.com/events/introduction-to-custom-events/
0
 

Author Closing Comment

by:Drevo
ID: 40411052
Thank you so much for your very clear example as to how to accomplish this! It works great!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How can I make a css class read only with jquery? 2 37
Jquery form submit not working ? 7 36
combining jquery scripts 3 21
Angular - disable input field on page load 4 15
by Julian Matz As of jQuery (http://jquery.com/) 1.4 the .live() method (http://api.jquery.com/live/) supports custom events as well as some standard JavaScript events that it previously didn't support. Among these is the submit event. Unlike …
DOM Attributes and Properties treatment with jQuery 1.6 by Ivo Stoykov jQuery (http://jquery.com/) 1.6 introduces .prop() (http://api.jquery.com/prop/) and .removeProp() (http://api.jquery.com/removeProp/) methods which allow modifying or removi…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now