Join MDN and developers like you at Mozilla's View Source conference, 12-14 September in Berlin, Germany. Learn more at https://viewsourceconf.org

deleteFromDocument Redirect 1

« DOM Reference

Summary

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

Syntax

sel.deleteFromDocument()

Parameters

None.

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."

 

Document Tags and Contributors

 Last updated by: Sheppy,