JavaScript Reference/Javascript Methods/clear

Материал из Web эксперт
Перейти к: навигация, поиск

"clear()" Example

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



"clear()" is applied to

+----------------+--------------------------------------------------------------+
| Applied_To     |selection                                                     |
+----------------+--------------------------------------------------------------+



"clear()" Syntax, Parameters and Note

Note:
Delete selection contents.
    
Syntax:
    
document.selection.clear()