1

When my content editable <div> (chat field) gets blurred, the keyboard closes but the (blue) cursor remains visible.

Is there a way to hide the cursor?

<div class="chat-message" contenteditable="true" data-ph="Typ een bericht..."></div>

After blurring

arainone
  • 1,928
  • 17
  • 28
Jamie
  • 3,031
  • 5
  • 36
  • 59
  • This is not directly related to ionic but pure html. There are different ways to solve this here http://stackoverflow.com/q/3671141/4515566 – arainone Jan 07 '16 at 22:50
  • @arainone That topic is about carets, not about cursors. I ment the blue icon. – Jamie Jan 08 '16 at 14:23
  • ha ok.. but isn't this blue cursor your phone native cursor? If that is the case, i don't know about any pure javascript solution to this problem, you would have to mess with native code... or use a ionic/cordova plugin it that exists. – arainone Jan 08 '16 at 15:25
  • Im afraid it is. I will take a look, thanks – Jamie Jan 08 '16 at 19:09

1 Answers1

0

After searching some more I stumbled on the following topic: How can I blur a div where contentEditable=true?

It seems that content editable works a bit different than normal textareas. You have to clear the selection, which actually sounds really obvious when you think about it..

So what works for me is the following:

 $('#chat .chat-footer .chat-actions .chat-message').on('blur', function () {
        window.getSelection().removeAllRanges();
    });
Community
  • 1
  • 1
Jamie
  • 3,031
  • 5
  • 36
  • 59