Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript focus on contenteditable not working

//so p is basically your element you want to focus correctly
var p = document.getElementById('contentEditableElementId'),
    s = window.getSelection(),
    r = document.createRange();
r.setStart(p, 0);
r.setEnd(p, 0);
s.removeAllRanges();
s.addRange(r);
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #javascript #focus #contenteditable #working
ADD COMMENT
Topic
Name
7+2 =