It’s for a backbone application,
I’m using Jquery html() function to insert my views templates into the layout everywhere, and I would like to be able to trigger an event each time the html() function of jQuery is called to check the html of the page.
Is there a way to do that ?
( Like App.on(‘html’, blablabla…); )
Thank you !
As Marc B suggested DOM MutationEvents is available on some browsers (not many). By default jQuery does not fire any event when using
html, but you can define your own behaviour for this, for example:It should work, didn’t test it though. You can use the same with
.textmethod. Now you can simply use:That’s the idea, use it as you wish.