Javascript Reference
Categories: selection

javascript selection anchorNode, focusNode

@April 28, 2008, 3:33 p.m.
anchorNode, focusNode Firefox/Netscape/NN 6 IE n/a Chrome/Safari/DOM n/a  

 

Read-only  

Return a reference to the node where the user started (anchor) and ended (focus) the selection. Most typically, these are text node types. If the selection is set or extended via the addRange( ) method, these properties point to the node boundaries of the most recently added range.

 
Example
 
var anchor = selectionRef.anchorNode;
if (anchor.nodeType == 3 && anchor.parentNode.tagName == "td") {
// process selection start inside a table cell
}
 
Value

Reference to a document tree node, or null if no selection.

 
Default

null

Hello! My name is Lidia Clubbe and I live in Callaway,FL. I have read your blog post about Comments of javascript selection anchorNode, focusNode and I want to say that I am quite impressed with your professionalism on the subject!
Bocarupporo - 2016-01-10

Powered by Linode.