I use jQuery's event object to get the target's parent. The code is:
event.target.parentElement
In Chrome it works, but in Firefox, it doesn't. I use alert() to print the output.
alert()
event.target is an URL in both Chrome and Firefox; but event.target.parentElement in Chrome is [Element object], and in Firefox it is null.
event.target
null
What should I do to solve this problem? I still wonder if IE will have this problem?
Thanks.
To access the parent, you could do:
var par = $(event.target).parent();
2.1m questions
2.1m answers
60 comments
56.8k users