Get the name (type) of the event that was fired (triggered)
@Vega solution is correct for simple events. However, if you namespace your events, (i.e. player.play
) then you must get the namespace as well. For example, lets say I trigger the event:
$('#myElement').trigger('player.play');
Then to get the full event name, you need to do the following:
$('#myElement').on('player.play', function(e) {
console.log('Full event name: ' + e.type + '.' + e.namespace);
});
event.type
will get you what you want.
DEMO
See also: List of event types
$('#button').on('click change', function(){
console.log(event.type + ' is fired');
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<input type="text" id="tipo-imovel" />