jQuery & jQuery UI Documentation

jQuery & jQuery UI

event.namespace

event.namespace Returns: String

Description: The namespace specified when the event was triggered.

  • version added: 1.4.3event.namespace

This will likely be used primarily by plugin authors who wish to handle tasks differently depending on the event namespace used.

Example:

Determine the event namespace used.

<!DOCTYPE html>
<html>
<head>
  <script src="http://code.jquery.com/jquery-1.7rc2.js"></script>
</head>
<body>
  
<button>display event.namespace</button>
<p></p>

<script>
$("p").bind("test.something", function(event) {
  alert( event.namespace );
});
$("button").click(function(event) {
  $("p").trigger("test.something");
});  
</script>

</body>
</html>