JavaScript - Snippets


getBookmarkRange

Gets a bookmark's range. Throws an error if the bookmark does not exist.


getBookmarkRangeOrNullObject

Gets a bookmark's range. Returns a null object if the bookmark does not exist.


deleteBookmark

Deletes a bookmark, if it exists, from the document.


Range.getBookmarks

Gets the names all bookmarks in or overlapping the range. A bookmark is hidden if its name starts with the underscore character.


Range.insertBookmark

Inserts a bookmark on the range. If a bookmark of the same name exists somewhere, it is deleted first.
when we insertText, a new range is returned, we need to use that range to insertBookmark.


© 2026 Better Solutions Limited. All Rights Reserved. © 2026 Better Solutions Limited TopPrev