inside js function I'm receiving event as parameter, how do you get the value of the event target?
function myFn(event){
...
close: function(event){
var myVal = ...
/// should grab from
/// event-> arguments -> [0]->target -> property value painted in yellow (abc)
}
}
Try: function($event) { const value = $event. target.
The target event property returns the element that triggered the event. The target property gets the element on which the event originally occurred, opposed to the currentTarget property, which always refers to the element whose event listener triggered the event.
You can use event.target.id in event handler to get id of element that fired an event.
This will work:
(<HTMLInputElement>event.target).value
or
event.target as HtmlInputlement
Try:
var myVal = event.target.value;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With