Click to Rate and Give Feedback
Properties
 UNSELECTABLE Attribute
UNSELECTABLE Attribute

Specifies that an element cannot be selected.

Syntax

HTML <ELEMENT UNSELECTABLE=bUnselectable ... >
ScriptingN/A

Possible Values

bUnselectableSpecifies whether an element is prohibited from being selected.
offDefault. Permits selection of the element.
onProhibits selection of the element.

Remarks

Note  Setting the UNSELECTABLE attribute to off does not ensure that an element is selectable. One example is an HTML Application (HTA) with the SELECTION attribute set to no. Elements in the body of the HTA cannot be selected, even if the UNSELECTABLE attribute for an element is set to off.

When you click on an element with the UNSELECTABLE attribute set to on, any existing current selection is not destroyed.

An element with the UNSELECTABLE attribute set to on can be included in a selection that starts somewhere outside the element.

The UNSELECTABLE attribute is implemented as an expando. Setting the expando property of the document object to false precludes the functionality of all expandos.

Example

This example shows that the UNSELECTABLE attribute is not inherited by child objects. Text in the TEXTAREA element can be selected and modified, but the text in the parent SPAN element cannot be selected.

<P>
<SPAN ID="oSpan" UNSELECTABLE="on" >This text cannot be selected.
<P>
<TEXTAREA WRAP="PHYSICAL" ROWS="5" STYLE="font-weight: bold;" ID="oTextarea">
This text can be selected and overwritten.
</TEXTAREA>
</P>
This text closes the SPAN and cannot be selected either.
</SPAN>
</P>

Standards Information

There is no public standard that applies to this attribute.

Applies To

A, ABBR, ACRONYM, ADDRESS, APPLET, AREA, B, BDO, BIG, BLOCKQUOTE, BODY, BUTTON, CAPTION, CENTER, CITE, CODE, CUSTOM, DD, DEL, DFN, DIR, DIV, DL, DT, EM, EMBED, FIELDSET, FONT, FORM, FRAME, FRAMESET, hn, HR, I, IFRAME, IMG, INPUT type=button, INPUT type=checkbox, INPUT type=file, INPUT type=hidden, INPUT type=image, INPUT type=password, INPUT type=radio, INPUT type=reset, INPUT type=submit, INPUT type=text, INS, ISINDEX, KBD, LABEL, LEGEND, LI, LISTING, MARQUEE, MENU, nextID, NOBR, OBJECT, OL, P, PLAINTEXT, PRE, Q, RT, RUBY, S, SAMP, SELECT, SMALL, SPAN, STRIKE, STRONG, SUB, SUP, TABLE, TBODY, TD, TEXTAREA, TFOOT, THEAD, TT, U, UL, VAR, XMP

See Also

Modifying Documents in Edit Mode, onselect, Select for Input controls, Select for textRange and controlRange collections
Community Content
 
Add Community Content
Is it working?      microsux ... John Sudds - MSFT   |   Edit   |  

I apply this attribute to a span and it still selectable.

---

There's a good chance that you are selecting another object first (like the body), then dragging the selection into the area occupied by the span. "An element with the UNSELECTABLE attribute set to on can be included in a selection that starts somewhere outside the element."

The unselectable attribute prevents the onselectstart event if you click on the element directly, but not if the selection begins elsewhere. For this reason, applying the attribute to a single span is much less effective than applying it to the entire document body, for example. (jsudds)

Tags What's this?: dhtml (x) Add a tag
© 2008 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker