prime
prime

Reputation: 15574

JavaScript FocusEvent relatedTarget Property not working in firefox

Check the provided article and it's w3school code for FocusEvent relatedTarget Property code example , it's perfectly working in Google chrome and not working in Firefox. (Use console to see the bugs)

The problem is in Chrome it will say the clicked element in an javascript alert box

But in firefox it says in console TypeError: event.relatedTarget is null

Why is this happening. how can I solve this problem.

Upvotes: 4

Views: 816

Answers (2)

satishkumar
satishkumar

Reputation: 146

use

event.target.tagName

it works in all browsers

Upvotes: 1

dinesh
dinesh

Reputation: 181

View in console while loading the page below the error was showing TypeError: event.relatedTarget is null

Upvotes: 0

Related Questions