Edit cursor not displayed on Chrome in contenteditable

The problem is that spans are inline elements. Just add display:block; to your CSS and it will fix the problem. $(myspan).focus(); #myspan { border: 0; outline: 0; display: block; } <script src=”https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js”></script> <span id=”myspan” contenteditable=true></span>

How to move the cursor to the end of a contenteditable entity

Geowa4’s solution will work for a textarea, but not for a contenteditable element. This solution is for moving the caret to the end of a contenteditable element. It should work in all browsers which support contenteditable. function setEndOfContenteditable(contentEditableElement) { var range,selection; if(document.createRange)//Firefox, Chrome, Opera, Safari, IE 9+ { range = document.createRange();//Create a range (a range … Read more

Contenteditable div vs. iframe in making a rich-text/wysiwyg editor

First of all… Don’t try to make your own WYSIWYG editor if you’re thinking about commercial use. It’s a cool idea for a personal project, because you can learn a lot, but it will take you years to create editor that you will be able to sell to someone that cares about if it really … Read more

How to disable elements selection and resizing in contenteditable div?

I spent on this a lot of time myself, when trying to completely hide control selections (this is how they are called) in CKEditor’s widgets. Unfortunately I don’t have a good news. Solution 1 First of all, there’s a mscontrolselect event. When I found it (and the fact that its name has an ms prefix) … Read more

contenteditable=false inside contenteditable=true block is still editable in IE8

Okay, I already have discovered the answer much like how Penicillin was discovered. You see, playing around with this code, I mistakenly set contenteditable to true for the span and voila! It worked! So, to make a span NON-contenteditable inside a contenteditable div, you just set its contenteditable attribute to true! <div contenteditable=”true”> Luke, I … Read more

selectionStart and selectionEnd in contenteditable element

Try this, it returns the selected text, no matter if it’s contentEditable or not. function GetSelectedText() { if (document.getSelection) { // all browsers, except IE before version 9 var sel = document.getSelection(); // sel is a string in Firefox and Opera, // and a selectionRange object in Google Chrome, Safari and IE from version 9 … Read more