[jQuery] Blur event for DIVs
Hi,
I want to trigger an action when a user moves the mouse outside of, or
clicks outside of a particular DIV (named "contextMenu" in the example
below). But nothing is triggering the event. Is my below code wrong
or is there no such thing as a "blur" event for DIVs?
Thanks, - Dave
<script type="text/javascript">
$(document).ready(
function () {
$('#contextMenu').blur(function() {
alert('blur'); // Never
gets called.
$(this).hide();
});
// Set classes for menu items.
$('.contextMenuItem').hover(function() {
$(this).attr('class',
'contextMenuItemHover');
},
function() {
$(this).attr('class',
'contextMenuItem');
});
}
);
</script>
<div id="contextMenu" style="display:none; position:absolute; border:
1px solid #000000;">
<div id="editTitle" class="editTitle contextMenuItem">Edit
Module Title</div>
<div id="myspace" class="myspace contextMenuItem">Export
MySpace HTML</div>
</div>