I am developing a website and now am testing in all browsers, I am currently testing in firefox and have found and error when using event.sourceElement?
What i need
Simple as
var val= (e.srcElement||e.target).value;
console.log(val);
function getTarget(obj) {
var targ;
var e=obj;
if (e.target) targ = e.target;
else if (e.srcElement) targ = e.srcElement;
if (targ.nodeType == 3) // defeat Safari bug
targ = targ.parentNode;
return targ;
}
Will return the target for all browsers if you pass it e
from:- http://www.quirksmode.org/js/events_properties.html
in firefox simply call e.target
to work. instead of e.srcElement
[which works only in IE]