Skip to content Skip to sidebar Skip to footer

File Input Javascript Click Generated Not From A Real Mouse Click Chrome

i'm having trouble in chrome opening the popup for the file upload of a file input type. As you can see here: http://jsfiddle.net/cavax/K99gg/3/, clicking on an elements can trigge

Solution 1:

If I remember correctly, mouseenter and mouseleave are specific to IE, not standard events. Maybe they were extended, but don't think they became a standard. So the event itself may generate you some problems.

To resolve this you can use a lib (like jQuery for example), that treats the browser differences (or you can check the code there and take what you need).

Second way... try mouseover... it worked better (again... didn't work with them for a while so things may have happened, but this is how I remember them to be).

Solution 2:

There is no way to trigger click event of input file type, because of a security reason.

You may try a hack of this by setting your button/div position to absolute and top to -100px It means positioning it outside the viewport by setting above style make it works.

But for mouseenter and mouseover i don't think it's going to work!

Edit:

Moved input outside the viewport and target click event

Example on click

Side note: Right now click occurs 2 times as you have written

$('#upload').trigger('click').click();

You just need

$('#upload').trigger('click');  //$('#upload').click() 

unless you want it to fire more than single time.

Post a Comment for "File Input Javascript Click Generated Not From A Real Mouse Click Chrome"