<!DOCTYPE html PUBLIC "- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>DOM Modification Event</title>
<script type="text/javascript" src="jquery-1.3.2.js"></script>
<script type="text/javascript">
$(function(){
$( "p#children a" )
.attr( "href", "javascript:void( 0 )" )
.dblclick(
function( objEvent ){
$( this ).remove();
return( false );
}
)
;
$( "p#nested a" )
.attr( "href", "javascript:void( 0 )" )
.dblclick(
function( objEvent ){
$( this.parentNode ).remove();
return( false );
}
)
;
$( "body" ).bind(
"DOMNodeRemoved",
function( objEvent ){
$( "#event-log" ).append(
"<li>" +
"Node removed: " +
$( objEvent.target ).text() +
"</li>"
);
}
);
});
</script>
</head>
<body>
<h1>
DOM Modification Event Demo
</h1>
<p id="children">
<a>Remove Me 1</a>
<a>Remove Me 2</a>
<a>Remove Me 3</a>
<a>Remove Me 4</a>
</p>
<p id="nested">
Child Action: <a>Remove my parent</a>
</p>
<h2>
Event Log
</h2>
<ul id="event-log" />
</body>
</html>