Visit Mozilla.org

DOM:Selection:deleteFromDocument

From MDC

« Gecko DOM Reference

Contents

[edit] Summary

Deletes the actual text being represented by a selection object from the document's DOM.

[edit] Syntax

sel.deleteFromDocument()

[edit] Parameters

None.

[edit] Examples

A user selects the (imaginary) text "ve two ea" from "Rabbits have two ears." on a web page. The user then clicks a button that executes the JavaScript snippet window.getSelection().deleteFromDocument(). The document's text becomes "Rabbits hars."