jquery - file input javascript click generated not from a real mouse click chrome -


i'm having trouble in chrome opening popup file upload of file input type.

as can see here: http://jsfiddle.net/cavax/k99gg/3/, clicking on elements can trigger click on file input, example hovering element wont trigger click on input.

$('#test').on('click', function(){    $('#upload').trigger('click'); }); $('#test').on('mouseenter', function(){    $('#upload').trigger('click'); }); 

in real life i'm having trouble because in web app i'm loading throw ajax content witch has inside input file. @ end of load popup file must open, there no way works on chrome (workign on ff).

the problem guess action not generated mouse click (hover, timeout etc) chrome wont trigger fileupload.

i've tryed this: http://jsfiddle.net/cavax/k99gg/7/, click on element, wait trigger click nothing, because there "settimeout" in middle of click , trigger :(

$('#test').on('click', function(){   settimeout(function(){     $('#upload').trigger('click');   }, 3000); }); 

if remove delay: http://jsfiddle.net/cavax/k99gg/8/ works idea work?

if remember correctly, mouseenter , mouseleave specific ie, not standard events. maybe extended, don't think became standard. event may generate problems.

to resolve can use lib (like jquery example), treats browser differences (or can check code there , take need).

second way... try mouseover... worked better (again... didn't work them while things may have happened, how remember them be).


Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

angularjs - ng-repeat duplicating items after page reload -