I have tried this, (note that I am using jQuery):
function HandleFileButtonClick()
{
1. //$('#filesel').click();
2. //document.replyform.image.click();
}
HTML:
<input type="file" id="filesel" name="image" style="display: none;" />
<a href="#"><img src="<?=TF?>/img/att.png" style="height:20px;" onclick="HandleFileButtonClick();" /></a>
neither are working in Google Chrome Browser... any ideas, or a replacement for jQuery click()
I am here to help other with a similar problem. I try use .trigger('click') to start a click event into a FILE field that was if style='display:none' and discovered that Chrome diferent from Mozila Firefox and IE don´t let it work with this style. The solution is don´t use display:none and use instead of it style='width:0px;height:0px'. The result is the same, the FILE field be hidden and you can use another button to start its works even in Chrome this time.
Best Regards peeps.
Sounds like you are hitting a security wall designed to only allow the file upload box to be triggered by the user.
You could try absolutely positioning the browser's browse button over your link, and then setting its opacity to 0.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With