I am using React, and have the following setup:
<input onBlur={(e) => {this.removeEditable(e)}} //...etc
/>
and
removeEditable(e) {
//Do Something
}
My problem is that I am trying to get the element clicked on from the event fired onBlur
. Please note, this may not be the same element as the element that originated the click. For example, the input
box above may be active, but the onblur event will get fired when the user clicks outside of the input
box.
I have tried event.target
but that gives the input element defined above - not the element that the actual click happened on.
Can this be done?
I am pretty sure for drag and drop this can be done but not sure about blur?
I have tried event.currentTarget
as was previously suggested below (and then removed), but that also returns the input element, in the same was as event.target does.
As a note, the element that is being clicked on is position absolute, and overlaid on top of a div without position type defined (eg standard position) - I am not sure if this could be affecting the event?
I have logged the event.currentTarget
and it seems to always return the input outlined above.