XML DOM target event property
Definition and Usage
The target event property returns the target node of the event (the node that triggered the event), such as the element that generates the event, the document, or the window.
Syntax
event.target
Example
The following example gets the element that triggered the event:
<html>
<head>
<script type="text/javascript">
function getEventTrigger(event)
{
x=event.target
;
alert("The id of the triggered element: "
+ x.id);
}
</script>
</head>
<body >
<p id="p1" onmousedown="getEventTrigger(event)">
Click on this paragraph. An alert box will
show which element triggered the event.</p>
</body>
</html>
TIY
- target ਇਵੈਂਟ
- ਇਵੈਂਟ ਨੂੰ ਟ੍ਰਿਗਰ ਕਰਨ ਵਾਲੇ ਅੰਗਾਮੇ ਪ੍ਰਾਪਤ ਕਰੋ (IE ਬਰਾਉਜ਼ਰ ਮਦਦ ਨਹੀਂ ਦਿੰਦਾ ਹੈ)。