title: Hiding soft keyboards on mobile devices when using contenteditable divs
body: <p>I am using contenteditable divs for a page to be viewed by mobile devices to get input for some stuff. I want the soft keyboard to hide when the user presses enter, instead of the normal action of enter in a div. My first attempt at getting it to work looks something like this:</p>
  
  <pre><code>if event.keyCode == 13 #enter
    event.preventDefault() #to prevent the normal behaviour of enter
    @$("#the_editable_div").blur()
  </code></pre>
  
  <p>However, it seems like this does not work as it would with an input. The div loses focus but the keyboard does not hide on either iOS or android.</p>
  
  <p>I have also tried the solution at <a href="https://stackoverflow.com/questions/8949222/closing-keyboard-on-ipad-in-div-contenteditable">Closing keyboard on iPad in div contenteditable</a> but found that it did not work. If I focus on another text field and blur on iOS stuff it still does not close the keyboard, and on android I have found that it changes the keyboard to one used for regular  fields, where pressing enter again will close the keyboard, but that is not the expected behaviour of it closing immediately when enter is pressed in the contenteditable div field. This seems strange to me since if I were to tap on that input field myself and then blur it via javascript then the keyboard closes properly.</p>
  
  <p>Is there a way to have a contenteditable div that closes the soft keyboards on android and iOS devices when enter is pressed when that div is focused?</p>