javascript selection anchorNode, focusNode

anchorNode, focusNode NN 6 IE n/a 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


1738,Nickname,Homepage or email,Comments here,Add comment