• Skip to main content
  • Skip to search
  • Skip to select language
MDN Web Docs
  • References
    • Overview / Web Technology

      Web technology reference for developers

    • HTML

      Structure of content on the web

    • CSS

      Code used to describe document style

    • JavaScript

      General-purpose scripting language

    • HTTP

      Protocol for transmitting web resources

    • Web APIs

      Interfaces for building web applications

    • Web Technology

      Web technology reference for developers

  • Guides
    • Overview / MDN Learning Area

      Learn web development

    • MDN Learning Area

      Learn web development

    • HTML

      Learn to structure web content with HTML

    • CSS

      Learn to style content using CSS

    • JavaScript

      Learn to run scripts in the browser

    • Accessibility

      Learn to make the web accessible to all

  • MDN Plus
    • Overview

      More MDN. Your MDN.

    • FAQ

      Frequently asked questions about MDN Plus

  • Already a subscriber?
  • Get MDN Plus
  1. Technologies web pour développeurs
  2. Référence Web API
  3. Document
  4. document.getSelection

Cette page a été traduite à partir de l'anglais par la communauté. Vous pouvez également contribuer en rejoignant la communauté francophone sur MDN Web Docs.

Related Topics

  1. Document Object Model
  2. Document
  3. Constructeur
    1. Document()
  4. Propriétés
    1. activeElement
    2. Deprecated alinkColor
    3. Deprecated all (en-US)
    4. Deprecated anchors
    5. Deprecated applets
    6. Deprecated bgColor
    7. body
    8. characterSet
    9. childElementCount (en-US)
    10. children (en-US)
    11. compatMode
    12. contentType
    13. currentScript
    14. defaultView
    15. designMode
    16. dir
    17. doctype
    18. documentElement
    19. documentURI
    20. Deprecated domain
    21. embeds (en-US)
    22. featurePolicy
    23. Deprecated fgColor (en-US)
    24. firstElementChild (en-US)
    25. fonts (en-US)
    26. forms
    27. Deprecated fullscreen (en-US)
    28. fullscreenElement (en-US)
    29. fullscreenEnabled (en-US)
    30. head
    31. Deprecated height
    32. hidden
    33. images
    34. implementation
    35. lastElementChild (en-US)
    36. lastModified
    37. Deprecated lastStyleSheetSet
    38. Deprecated linkColor (en-US)
    39. links (en-US)
    40. location
    41. Non-Standard mozSyntheticDocument
    42. Non-Standard msCapsLockWarningOff (en-US)
    43. Experimental Deprecated origin
    44. pictureInPictureElement (en-US)
    45. pictureInPictureEnabled (en-US)
    46. plugins (en-US)
    47. pointerLockElement (en-US)
    48. Deprecated preferredStyleSheetSet
    49. readyState
    50. referrer
    51. Deprecated rootElement (en-US)
    52. scripts
    53. scrollingElement
    54. Deprecated selectedStyleSheetSet
    55. styleSheets
    56. Deprecated styleSheetSets
    57. Experimental timeline (en-US)
    58. title
    59. URL
    60. visibilityState
    61. Deprecated vlinkColor (en-US)
    62. Deprecated width
    63. Deprecated xmlEncoding
    64. Deprecated xmlVersion
  5. Méthodes
    1. adoptNode()
    2. append() (en-US)
    3. caretPositionFromPoint() (en-US)
    4. Non-Standard caretRangeFromPoint()
    5. Deprecated clear()
    6. close() (en-US)
    7. createAttribute()
    8. createAttributeNS() (en-US)
    9. createCDATASection()
    10. createComment()
    11. createDocumentFragment()
    12. createElement()
    13. createElementNS()
    14. Deprecated createEntityReference()
    15. createEvent()
    16. createExpression()
    17. createNodeIterator()
    18. createNSResolver()
    19. createProcessingInstruction()
    20. createRange()
    21. createTextNode()
    22. Deprecated createTouch() (en-US)
    23. Deprecated createTouchList() (en-US)
    24. createTreeWalker()
    25. elementFromPoint()
    26. elementsFromPoint()
    27. Deprecated enableStyleSheetsForSet()
    28. evaluate()
    29. Deprecated execCommand()
    30. exitFullscreen()
    31. exitPictureInPicture() (en-US)
    32. Experimental exitPointerLock()
    33. getAnimations() (en-US)
    34. getElementById()
    35. getElementsByClassName()
    36. getElementsByName()
    37. getElementsByTagName()
    38. getElementsByTagNameNS()
    39. getSelection()
    40. hasFocus()
    41. hasStorageAccess() (en-US)
    42. importNode()
    43. Non-Standard mozSetImageElement()
    44. open()
    45. prepend() (en-US)
    46. Deprecated queryCommandEnabled() (en-US)
    47. Deprecated queryCommandSupported()
    48. querySelector()
    49. querySelectorAll()
    50. Deprecated registerElement()
    51. releaseCapture()
    52. replaceChildren() (en-US)
    53. requestStorageAccess() (en-US)
    54. write()
    55. writeln()
  6. Événements
    1. Non-Standard afterscriptexecute
    2. animationcancel (en-US)
    3. animationend (en-US)
    4. animationiteration (en-US)
    5. animationstart (en-US)
    6. Non-Standard beforescriptexecute
    7. copy (en-US)
    8. cut (en-US)
    9. DOMContentLoaded
    10. drag
    11. dragend
    12. dragenter
    13. dragleave
    14. dragover
    15. dragstart
    16. drop
    17. fullscreenchange
    18. fullscreenerror
    19. gotpointercapture (en-US)
    20. keydown (en-US)
    21. Deprecated keypress
    22. keyup (en-US)
    23. lostpointercapture (en-US)
    24. Non-Standard mssitemodejumplistitemremoved (en-US)
    25. Non-Standard msthumbnailclick (en-US)
    26. paste (en-US)
    27. pointercancel (en-US)
    28. pointerdown (en-US)
    29. pointerenter (en-US)
    30. pointerleave (en-US)
    31. pointerlockchange (en-US)
    32. pointerlockerror (en-US)
    33. pointermove (en-US)
    34. pointerout (en-US)
    35. pointerover (en-US)
    36. pointerup (en-US)
    37. readystatechange
    38. scroll
    39. selectionchange (en-US)
    40. selectstart (en-US)
    41. touchcancel (en-US)
    42. touchend
    43. touchmove (en-US)
    44. touchstart (en-US)
    45. transitioncancel (en-US)
    46. transitionend
    47. transitionrun (en-US)
    48. transitionstart (en-US)
    49. visibilitychange (en-US)
    50. wheel (en-US)
  7. Héritage :
    1. Node
    2. EventTarget
  8. Pages liées à DOM
    1. AbortController (en-US)
    2. AbortSignal
    3. AbstractRange (en-US)
    4. Attr
    5. CDATASection
    6. CharacterData
    7. Comment
    8. CustomEvent
    9. DOMError
    10. DOMException
    11. DOMImplementation
    12. DOMParser
    13. DOMPoint
    14. DOMPointReadOnly
    15. DOMRect
    16. DOMTimeStamp
    17. DOMTokenList
    18. DocumentFragment
    19. DocumentType
    20. Element
    21. Event
    22. EventTarget
    23. HTMLCollection
    24. MutationObserver
    25. NamedNodeMap
    26. Node
    27. NodeIterator
    28. NodeList
    29. ProcessingInstruction
    30. Range
    31. StaticRange (en-US)
    32. Text
    33. TextDecoder (en-US)
    34. TextEncoder
    35. TimeRanges
    36. TreeWalker
    37. XMLDocument

document.getSelection

Cette méthode fonctionne de manière identique à la méthode Window.getSelection() ; elle renvoie un objet Selection représentant le texte actuellement sélectionné dans le document.

Found a problem with this page?

  • Edit on GitHub
  • Source on GitHub
  • Report a problem with this content on GitHub
  • Want to fix the problem yourself? See our Contribution guide.

Last modified: 2 oct. 2021, by MDN contributors

MDN logo

Your blueprint for a better internet.

  • MDN on Twitter
  • MDN on GitHub

MDN

  • About
  • Hacks Blog
  • Careers

Support

  • Product help
  • Report a page issue
  • Report a site issue

Our communities

  • MDN Community
  • MDN Forum
  • MDN Chat

Developers

  • Web Technologies
  • Learn Web Development
  • MDN Plus
Mozilla logo
  • Website Privacy Notice
  • Cookies
  • Legal
  • Community Participation Guidelines

Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2022 by individual mozilla.org contributors. Content available under a Creative Commons license.