You are here: Reference > JavaScript > client-side > HTML DOM > properties > isTextEdit

isTextEdit property

Browser support:
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:

object.isTextEdit;
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:
false
Do not use the createTextRange method on the element.
true
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? yes no

Supported by objects:

Related pages:

External links:

User Contributed Comments

Post Content

Post Content