HTML DOM selection.type property Last Updated : 21 Jun, 2023 Comments Improve Suggest changes Like Article Like Report The type property returns a String which describes the type of current selection. This is a read-only property. Syntax: selection.type Return Value: String describing the type of the selection. Possible return values are: None: No selection has currently been made.Caret: Only Clicked but not selected. The selection is collapsed, the caret is placed on some text, but no range has been selected.Range: Some range on which the text has been selected. Example: In this example, the getSelection() method is used to get the selected text, and the type property is used to get the type of selection. HTML <!DOCTYPE html> <html> <head> <title> HTML DOM selection type property </title> </head> <body> <h1>GeeksforGeeks</h1> <p> select some text and see its type in console </p> <script> let selection; document.onselectionchange = function () { selection = document.getSelection(); console.log(selection) console.log(selection.type); }; </script> </body> </html> Output: In the console, types of selections can be seen on every change of selection. Supported Browsers: Google ChromeEdgeFirefoxOperaSafariInternet Explorer Comment More infoAdvertise with us Next Article HTML DOM selection.type property T taran910 Follow Improve Article Tags : JavaScript Web Technologies HTML HTML-DOM Similar Reads HTML | DOM Select type Property The Select type property is used for returning the type of form element a drop-down list is. A drop-down list can be of two types, which are "select-one" or "select-multiple".Syntax: selectObject.type Return Value: A String, representing the type of form element the drop-down list (<select> el 1 min read HTML | DOM Select size Property The Select size property is used to set or return the value of the size attribute of a drop-down list. The Select size attribute is generally used to specify the number of visible options in a drop-down list.Syntax: For returning the size property: selectObject.sizeFor setting the size property: sel 2 min read HTML DOM Script type Property The DOM Script type Property is used to set or return the value of the type attribute of a <script> element. The type attribute is used to specify the MIME type of a script. and identify the content of the <script> Tag. It has a Default value which is "text/javascript". Syntax: It is use 2 min read HTML | DOM Select value Property The Select value property is used for setting or returning the value of the selected option in a drop-down list. The Select value property returns the first selected option if the drop-down list allows multiple selections, otherwise, if there are no selected options, nothing is returned.Syntax: For 2 min read HTML | DOM Select name Property The select name property in HTML DOM is used to set or return the value of name attribute of a drop-down list. This property returns a string which represents the name of the drop-down list. Syntax: It returns the select name property. selectObject.name It is used to set the select name property. se 2 min read Like