isTextEdit property
Returns a Boolean value that indicates whether the createTextRange method can be used for the element.
The createTextRange method is supported by the body, button, textarea and the input elements,
but the use of the method raises an exception for some input elements (checkbox, image, radio).
The isTextEdit property can be used to avoid the exception.
Syntax:
You can find the related objects in the Supported by objects section below.
This property is read-only.
Possible values:
Boolean that indicates whether the createTextRange method can be used for the element.
One of the following values:
Do not use the createTextRange method on the element. | |||||||
The createTextRange method can be used for the element. |
Default: this property has no default value.
Example HTML code 1:
This example illustrates the use of the isTextEdit property:
|
||||
<head> <script type="text/javascript"> function TextRangeTest () { if (document.body.createTextRange) { // Internet Explorer var container = document.getElementById ("container"); for (var i = 0; i < container.children.length; i++) { var elem = container.children[i]; if (elem.createTextRange) { if (elem.isTextEdit) { alert ("The createTextRange method can be used for " + elem.tagName + " elements."); } else { alert (elem.tagName + " elements support the createTextRange method, but the use of the method raises an exception."); } } else { // the elem.isTextEdit is false in this case alert (elem.tagName + " elements do not support the createTextRange method."); } } } else { // Firefox, Opera, Google Chrome and Safari alert ("Your browser does not support this example!"); } } </script> </head> <body> <div id="container"> <span>Some text</span> <input type="checkbox" />Simple check box <button>Simple button</button> </div> <br /><br /> <button onclick="TextRangeTest ()">Test the behaviour of the createTextRange method!</button> </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