Which property of the event object contains the HTML element that triggered the event?event.targetevent.sourceevent.triggerevent.element
Question
Which property of the event object contains the HTML element that triggered the event?
event.target
event.source
event.trigger
event.element
Solution
The property of the event object that contains the HTML element that triggered the event is event.target
.
In the context of event handling in JavaScript, event.target
refers to the specific element that is the actual source of the event. This is particularly useful when you have event listeners on parent elements and want to know which child element triggered the event.
Here’s a brief overview of the other options for clarity:
event.source
: This is not a standard property of the event object.event.trigger
: This is also not a standard property of the event object.event.element
: This is similarly not a standard property.
Thus, the correct choice is event.target
.
Similar Questions
Which of the following HTML attributes is used to handle a click event?1 pointonclickaddEventListener('click')'click'
Which of the following event occurs when user moves the mouse over an HTML element?
Which are properties of event object?Chọn đáp án đúng:type, target, optiontype, target, currentTargettype, target, scopetype, target, element
Which of the following event occurs when user moves the mouse away from an HTML element?Chọn đáp án đúng:onmouseoutonmouseoveronchangeonkeydown
How do you attach an event handler to a form element in JavaScript?element.addEventListener()element.setEventHandler()element.addEvent()element.onEvent()
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.