Is there a way using javascript/jquery to fire an event on an elements deletion? -


so example, have jsp page consists of singular div button inside div, jquery creating event handler buttons click. jsp page inserted jsp page inside of separate div using ajax. see code below example:

<div id="parent">     <div id="child">         <input id="rand" type="button" value="random" />         <script type="text/javascript">             jquery("#rand").on("click",function(){                 console.log("i clicked on random!");             });         </script>     </div>     <input id="changebtn" type="button" value="change" />     <script type="text/javascript">          jquery("#changebtn").on("click",function(){             jquery("#child").html("hello world!!");         });     </script> </div> 

what whenever elements/html/text within "child" div removed/replaced, on changebtn click event set html "child" "hello world", event fired clean events have been registered elements within "child" div. want click event handler "rand" button removed whenever text within div removed. similar window.unload event div whenever gets "unloaded".

i appreciate issue, if issue.


Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -