We are using asp.net webforms.
Server is generating input element (image) with onclick event.
When click occurs I’m calling function and passing event object into it.
Inside that function I am trying to access event.srcElement.className to get the class name of the element that caused the event.
Only in IE8 event’s srcElement is null.
What would be the possible solution to this problem?
How can I get the class name of the element that caused the click event inside the function that is called when event occurs?
Selected answer solves my problem but doesn’t answer the question!
You could use jQuery library wich would help with cross browser issues. Using jQuery you could use event.target and all of it’s properties. Problem to this is inconsistent DOM API across various browsers.
In jQuery you could do like this: