parentTextEdit property
Returns the closest ancestor element of the current element in the DOM hierarchy that can be used to create a TextRange object.
A call to the createTextRange method on the returned element creates a TextRange object that contains the current element.
Syntax:
You can find the related objects in the Supported by objects section below.
This property is read-only.
Possible values:
Returns the object that can be used to create a TextRange object.
Default: this property has no default value.
Example HTML code 1:
This example illustrates the use of the parentTextEdit property:
|
||||
<head> <script type="text/javascript"> function CreateParentRange (elem) { //gets the first object that can be used to create a TextRange object var textRangeObj = elem.parentTextEdit ; // alert with the tagName of the object alert (textRangeObj.tagName); // create the TextRange var myTextRange = textRangeObj.createTextRange (); // select all contents in the TextRange myTextRange.select (); } </script> </head> <body> <div onclick="CreateParentRange (this)">Click this text to create a textRange from this division element!</div> </body> |
||||
|
||||
Did you find this example helpful?
|
Supported by objects:
CommentNode
HTML elements:
a, abbr, acronym, address, applet, area, b, base, basefont, bdo, bgsound, big, blockquote, body, br, button, caption, center, cite, code, col, colgroup, comment, dd, del, dfn, dir, div, dl, dt, em, embed, fieldset, font, form, frame, frameset, h1, h2, h3, h4, h5, h6, head, hr, html, i, iframe, img, input:button, input:checkbox, input:file, input:hidden, input:image, input:password, input:radio, input:reset, input:submit, input:text, ins, isindex, kbd, label, legend, li, link, listing, map, marquee, menu, meta, nobr, noframes, noscript, object, ol, optgroup, option, p, param, plaintext, pre, q, rt, ruby, s, samp, script, select, small, span, strike, strong, style, sub, sup, table, tbody, td, textarea, tfoot, th, thead, title, tr, tt, u, ul, var, wbr, xml, xmp
Related pages:
External links:
User Contributed Comments