I am trying to use an image as a file type button in my application, but on click of image the function is executing but button document.getElementById("myFile").click();
is not executing. Whats wrong with my code?
HTML:
<div align="center">
<a href="#" id="other-color" onClick='loadFile()'><img style="width:75px;height:auto" src="icons/slr-camera-2-256.png"/></a>
<input type="file" id="myFile" style="display:none" />
</div>
Script:
function loadFile()
{
alert("test");
document.getElementById("myFile").click();
}