Style userSelect Property

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP







<!--
main_leaderboard, all: [728,90][970,90][320,50][468,60]
-->




Style userSelect Property


❮ Style Object



Example


Prevent text selection of a <div> element:



document.getElementById("myDiv").style.userSelect = "none";

Try it Yourself »

More "Try it Yourself" examples below.



Definition and Usage



The userSelect property sets or returns whether the text of an element can be selected or not.


If you double-click on some text, it will be selected/highlighted. This property can be used to prevent this.



Browser Support


The numbers in the table specify the first browser version that fully supports the property.


Numbers followed by Webkit, Moz, or O specify the first version that worked with a prefix.















Property
userSelect 54.0
6.0 Webkit
10.0 ms 2.0 Moz 3.1 Webkit 41.0
15.0 Webkit


Syntax


Return the userSelect property:



object.style.userSelect

Set the userSelect property:



object.style.userSelect = "auto|none|text|all"

Property Values













Parameter Description
auto Default. Text can be selected according to the browser's default
settings
none Prevent text selection
text The text can be selected by the user
all Text selection is made with one click instead of a double-click





<!--
mid_content, all: [300,250][336,280][728,90][970,250][970,90][320,50][468,60]
-->




Technical Details








Default Value: auto
Return Value: A String, representing whether the text of an element can be selected
CSS Version CSS3

More Examples



Example


Get the value of the "user-select" property of an element:



document.getElementById("demo").style.userSelect;

Try it Yourself »


Related Pages


CSS reference: user-select property




❮ Style Object

Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

Edmonton

Crossroads (UK TV series)