I am trying to remove selection inside a contenteditable field. The code I have is this:
Text
here is the working code
$(document).ready(function() { $('h1').focus(); document.execCommand('selectAll', false, null); }) $("#deselect").click(function(){ window.getSelection().removeAllRanges(); });
https://jsfiddle.net/v73e3xdf/2/