Picnic Website Code Tutorials

iPhone/iPad Manually Trigger Keyboard on Div Javascript Tutorial

View Demo

Normally IOS only pops up the keyboard if you click in a textarea or input. Both of these JS snippets will pull up the keyboard on the iPhone and iPad if the text is in a div or other.

Method 1

<div onMouseDown="contentEditable=true">
  Text
</div>
		

Method 2

<div id="focus">
  Text
</div>
<script type="text/javascript">
  document.getElementById('focus').contentEditable=true;
</script>
		

Sponsors

Top Donators

Friends of Mine