hello allz, i have the same issue as the input text focus but this time it's with an input type ="file".
works well on computer but when i use my iphone or android i can't click on my button. I need to use landscape iphone display to work, and same issue with ipad..doesn't work..
i've try : to set it on autofocus by 3 way...
1:
|
Quellcode
|
1
|
inputelement.autofocus = "autofocus";
|
It's set well autofocus on computer (i see the button select when it's loaded, but don't work on my iphone)
2:
|
Quellcode
|
1
2
3
4
5
|
inputelement.addEventListener('touchstart',file_click, false);
function file_click()
{
inputelement.focus();
}
|
or these too :
3:
|
Quellcode
|
1
2
3
|
inputelement.addEventListener('touchstart',setfocus, false);
function setfocus(){ if(arguments.length<1)return; if(arguments[0]==='true')inputelement.focus(); else inputelement.blur(); }
|
and other things but nothing work :/ on landscape it's ok !
Another test with:
|
Quellcode
|
1
2
3
4
5
6
7
8
9
|
inputelement = document.createElement("input");
inputelement.type = "file";
inputelement.id = "myID";
function setfocus()
{
document.getElementById('myID').focus();
}
|