I have a function that is triggered by an click event… when clicked the function should get some information from the dom object that the click originated in. All this works fine in firefox, but in IE8 it is not making it past the alert 3.
function handleFileSelect(docEventTrigger) {
alert('1');
if($('#tblListDocs tr input[value!=""]').length>0){
alert('2');
updateClicked(instanceID);
}else{
alert('3');
var docName, docVersion, docDate, docAuthor, formHTML, actionText, docActions, docResults, frmTarget, docRowCount;
var files = docEventTrigger.target.files;
alert('4');
for (var iCount = 0, f; f = files[iCount]; iCount++) {
alert('5');
STUFF HAPPENS HERE
document.forms["frmUploadDoc"].submit();
alert('6');
}
}
The
targetattribute of event object is not cross browser. For IE, it should besrcElement.To make the code cross browser, get either of those who is defined:
That said, it won’t help your specific case as explained in this other answer.
To avoid having to mess around with the event, you can pass the object itself:
Then the function parameter will already be the file input itself. (Same as
senderin my above example)