Question: event.target.form returns null in Internet Explorer

Question

event.target.form returns null in Internet Explorer

Answers 0
Added at 2017-11-08 16:11
Tags
Question

I am building a complete dynamic rendering web application using ReactJS. In a case, I need to get the form elements on click action.

So, I used event.target.form.elements and it worked well in Chrome and Mozilla. But when I test the Application in IE, returns null. ie event.target.form is null.

From blog suggestions, I used event.currentTarget and event ? event.target : window.event.srcElement but that too didn't work. I wrote a function doing similar as below,

function getTarget(e) {
  var evn = e || window.event;
  return evn.srcElement || e.target;
}

still didn't work.

Is there any work around to get this get passed in IE browser. The version on IE using is IE 11.

Answers to

event.target.form returns null in Internet Explorer

Source Show
◀ Wstecz