Sie sind nicht angemeldet.

1

Donnerstag, 14. Juni 2018, 23:39

Focus on input type = "file"

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();

	}

Dieser Beitrag wurde bereits 5 mal editiert, zuletzt von »ChukA« (15. Juni 2018, 16:33)


2

Sonntag, 17. Juni 2018, 19:05

it's ok then...
i've created a layer who call my Js fonction...

i don't know why the input "file" can't be clicked itself (but to be honest i don't care, 'cause i can put all style that i want to my layer :)), same issue with "checkbox" or "button".
regards
thread is close for me :)

Thxxx

3

Dienstag, 3. Juli 2018, 10:59

the response is: the input file don't need to be focused but clicked ;)