jQuery Tutorial Tutorials - jQuery event.target

jQuery event.target

The event.target property in jQuery refers to the DOM element that initiated the event.

jQuery event.target property Example

example

Display the tag's name on click

$("button").click(function(e){
    $('#log').append('<p>the tag\'s name on click is: '+ e.target.nodeName +'</p>');
});

Try now

Date:2019-08-29 18:56:47 From:www.Lautturi.com author:Lautturi