javascript - click event not firing in IE11 -


I have this JS file:

  function firecrack (node) {if ( Document. CreateEvent) {var evt = document.createEvent ('MouseEvents'); Evt.initEvent ('click', true, incorrect); Node.dispatchEvent (evt); } And if (document.createEventObject) {node.fireEvent ('onclick'); } And if (click on node type == 'function') {node.onclick (); }} Select function avatar () {var fileSelector = document.createElement ('input'); FileSelector.setAttribute ('type', 'file'); FileSelector.setAttribute ('Accept', 'Image / GIF, Image / JPEG'); FileSelector.onchange = function (event) {var fileList = fileSelector.files; //alert(fileList.length); If return (fileList.length == 0); Reader.readAsDataURL (FileList [0]); } Var Reader = New FileReader (); Reader.load = function (e) {var dataURL = reader.result; // warning (dataURL); Var Container = document.getElementById ("avatart-container-div"); Var backgroundIMgString = 'url ("' + dataURL + '') '; container.style.backgroundImage = backgroundIMgString;} FireCall (file selector);}   

to select an IMG The programmer is about to open a file picker, whereas it works on FF and Chrome, it does not work on IE (11 is my version) The picker did not see itself, tried the debugging line by line, but everything looks fine (No error or exception) is any idea what the problem is

Remarks from comments:

You actually become the only element Adding without to DOM can add it to the DOM: document.body.appendChild (fileSelector);

and selectvertary function :

  Select function invalid () {var fileSelector = document.createElement ('input'); FileSelector.setAttribute ('type', 'file'); FileSelector.setAttribute ('accept' , "Image / gif, image / jpeg"); Document.body.appendChild (fileSelector); // do stuff}   

also Ð · Ð'Ñ ?? Ð ° Ñ ?? Ñ ​​?? и

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -