label.ondblclick = function() { var selection = window.getSelection(), range = document.createRange(); selection.removeAllRanges(); range.selectNode(this); selection.addRange(range); }