HTML | DOM Style userSelect Property Last Updated : 05 Jun, 2022 Comments Improve Suggest changes Like Article Like Report The DOM Style UserSelect Property is used to set or return whether the text can be selected by the user or not. Syntax: It is used to return the property: object.style.userSelectIt is used to set the property: object.style.userSelect = "auto|none|text|all" Properties : auto: It has the default value i.e. the user can select the text.none: It is used to prevent text selection from the user means user can’t select the text on its own.text: This property enable the user to select the text. It does not provide prevent text selection from the user.all: It is used to selected the text with just one-click of a mouse instead of a double-click. Return Values: It returns a string value which represents whether the text of an element can be selected.Example-1: html <!DOCTYPE html> <html> <head> <title> DOM Style user-select property</title> <style> div { -webkit-user-select: auto; -moz-user-select: auto; -ms-user-select: auto; user-select: auto; } h1, h3 { color: green; font-size: 30px; } body { text-align: center; } </style> </head> <body> <h1>GeeksforGeeks</h1> <h3>DOM Style UserSelect Property</h3> <div id="GFG">GeeksforGeeks: A computer science portal for geeks</div> <br> <button onclick="myGeeks()">Submit</button> <script> function myGeeks() { var x = document.getElementById("GFG"); // Chrome, Safari, Opera x.style.WebkitUserSelect = "none"; // Firefox x.style.MozUserSelect = "none"; // IE 10+ x.style.msUserSelect = "none"; // Standard syntax x.style.userSelect = "none"; } </script> </body> </html> Output : Before Clicking On Button: After Clicking On Button: Example-2: html <!DOCTYPE html> <html> <head> <title> DOM Style user-select property</title> <style> h1, h3 { color: green; font-size: 30px; } body { text-align: center; } </style> </head> <body> <h1>GeeksforGeeks</h1> <h3>DOM Style UserSelect Property</h3> <div id="GFG" style="user-select:auto;"> GeeksforGeeks: A computer science portal for geeks </div> <br> <button onclick="myGeeks()">Submit</button> <script> function myGeeks() { alert(document.getElementById( "GFG").style.userSelect); } </script> </body> </html> Output: Before Clicking On Button: After Clicking On Button: Note: The double-click on some text will be selected/highlighted but this property can be used to prevent this.Supported Browser: The browser supported by DOM Style UserSelect are listed below: Google Chrome 54 and aboveEdge 79 and aboveInternet Explorer 10 and aboveFirefox 69 and aboveOpera 41 and aboveSafari 3 and above Create Quiz Comment M manaschhabra2 Follow 0 Improve M manaschhabra2 Follow 0 Improve Article Tags : Web Technologies HTML HTML-DOM HTML-Property Explore HTML BasicsHTML Introduction4 min readHTML Editors4 min readHTML Basics7 min readStructure & ElementsHTML Elements4 min readHTML Attributes7 min readHTML Headings3 min readHTML Paragraphs3 min readHTML Text Formatting4 min readHTML Block and Inline Elements3 min readHTML Charsets4 min readListsHTML Lists3 min readHTML Ordered Lists5 min readHTML Unordered Lists4 min readHTML Description Lists3 min readVisuals & MediaHTML Colors11 min readHTML Links Hyperlinks2 min readHTML Images7 min readHTML Favicon4 min readHTML Video4 min readLayouts & DesignsHTML Tables9 min readHTML Iframes4 min readHTML Layout4 min readHTML File Paths3 min readProjects & Advanced TopicsHTML Forms4 min readHTML5 Semantics5 min readHTML URL Encoding4 min readHTML Responsive Web Design11 min readTop 10 Projects For Beginners To Practice HTML and CSS Skills8 min readTutorial ReferencesHTML Tags - A to Z List5 min readHTML Attributes Complete Reference8 min readHTML Global Attributes5 min readHTML5 Complete Reference8 min readHTML5 MathML Complete Reference3 min readHTML DOM Complete Reference15+ min readHTML DOM Audio/Video Complete Reference2 min readSVG Element Complete Reference5 min readSVG Attribute Complete Reference8 min readSVG Property Complete Reference7 min readHTML Canvas Complete Reference4 min read Like