empty event

empty event


I'm working with jQuery 2.1.4. My web application uses different div tags and on one div tag there is called empty() from different modules. In my main module I would like to get an event if any submodule calls empty on my div. In code it should be:

  1. jQuery("#mydiv").on("empty", function(event) { 
  2.    console.log("div is cleared");
  3. });
and on submodul

  1. jQuery("#mydiv").empty();
How can I do this?