senior
senior

Reputation: 2276

IE js error with event.target !==

I have the following js code:

if ( event.target !== self.element[ 0 ]){
  ...
 } 

In IE browser I get this error: Object doesn't support this property or method

when I write my code :

if ( event.target == self.element[ 0 ]){
  ...
 } 

I don't get a js problem

what is not supported by IE? the !==?!!

Upvotes: 0

Views: 116

Answers (1)

Pointy
Pointy

Reputation: 413996

Well there's no "target" property in IE; it's event.srcElement. So try

if ((event.target || event.srcElement) !== self.element[0]) 

Upvotes: 4

Related Questions