contenteditable – select all on double click [ 1140 views ]
Goal: don’t be fool, do it easy
A have a DIV with contenteditable=”true” attribute. Like a textbox but not really. I want to select all the content with a double click on it. With jQuery like this:
var myDIV = ...;
myDIV.on({
dblclick: function(){
// one line code coming
document.execCommand('selectAll', false, null);
}
});
… so do you know better than this solution? …
I have read many scientific solution for this problem. Don’t be fool, just do it easy…



