Reputation: 1160
When clicking an input field on an iOS device, it will zoom in on that element. Can i disable this focus event?
Upvotes: 9
Views: 11675
Reputation: 61
Best solution to disable auto zoom in mobile devices on touch event
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1">
Upvotes: 0
Reputation: 490
document.getElementById("idOfInputField").onfocus = function(){return false;}
Upvotes: 0
Reputation: 626
I think you would be better to set the viewport:
<meta name="viewport" content="width=device-width, user-scalable=no" />
Upvotes: 2
Reputation: 3327
I put up this gist which solves the problem. https://gist.github.com/2008932
The accepted solution is not correct, as it will cancel focus altogether, which prevents data entry.
Upvotes: 13