<!DOCTYPE html PUBLIC "- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>jQuery Test Binding</title>
<script type="text/javascript" src="jquery-latest.pack.js"></script>
<script type="text/javascript">
$(
function(){
var jP = $( "p:first" );
var jSpan = $( "span:first" );
var jAdd = $( "button.add" );
var jRemove = $( "button.remove" );
function Add(){
jP.append( jSpan );
}
function Remove(){
jP.empty();
}
function Bold(){
jSpan.css( "font-weight", 800 );
}
function Unbold(){
jSpan.css( "font-weight", 400 );
}
jSpan
.click( Remove )
.hover( Bold, Unbold )
;
jAdd.click( Add );
jRemove.click( Remove );
}
);
</script>
</head>
<body>
<form>
<p>
<span>Click To Remove</span>
</p>
<button type="button" class="add">
Add
</button>
<button type="button" class="remove">
Remove
</button>
</form>
</body>
</html>