Select all in contenteditable focus
http://stackoverflow.com/q/34950616/145346
by Mottie
HTML
<div contenteditable="true">0,00</div>
JavaScript
$('div[contenteditable]').on('focus', function() {
var cell = this;
// select all text in contenteditable
// see http://stackoverflow.com/a/6150060/145346
var range, selection;
if (document.body.createTextRange) {
range = document.body.createTextRange();
range.moveToElementText(cell);
range.select();
} else if (window.getSelection) {
selection = window.getSelection();
range = document.createRange();
range.selectNodeContents(cell);
selection.removeAllRanges();
selection.addRange(range);
}
});