I am running into a weird problem. Not sure if it is due to the security concern of any other reason. I have following piece of code:
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<h1>This is a Heading</h1>
<p>This is a paragraph.</p>
<button onclick='someThgTemp()'>TRY</button><br /><br /><br /><br />
<label id='labelId' for='some'>sdfasdf</label>
<input id='some' type='file'/>
</body>
<script>
var someThg = function someThg(){
alert(2);
console.log(document.getElementById('labelId'));
document.getElementById('labelId').click();
}
function someThgTemp(someThg){
alert('1');
var that = this;
window.setTimeout(function(){
that.someThg();
}, 3000)
alert(3)
}
</script>
</html>
So on this line:
<button onclick='someThgTemp()'>TRY</button>
the file chooser dialog is not shown
Where as if I change the above line to following
<button onclick='someThg()'>TRY</button>
The file chooser is called.Please let me know what I am doing wrong and what is the alternative for it.
The reason to do this being, before showing the file browser I need to validate something. If validated then only I want to show the user file browser.