Clear a selection : Selection « Document « JavaScript DHTML






Clear a selection

    
<head>
<script language="JavaScript">
   function function1() {
       document.selection.clear();
   }
</script>
</head>
<body>
<p id="myP" contenteditable>
Select any part of it and click the button below.</p>
<button onclick="function1();">Delete selection</button>
</body>
</html>

    
      
      








Related examples in the same category

1.Selection type
2.Selection type Detail Example
3.Empty a selection