Range: toString()-Methode
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since March 2017.
Die Range.toString()
-Methode ist ein Stringifier, der den Text des Range
zurückgibt.
Syntax
js
toString()
Parameter
Keine.
Rückgabewert
Ein String.
Beispiele
HTML
html
<p>
This example logs <em>everything</em> between the emphasized <em>words</em>.
Look at the output below.
</p>
<p id="log"></p>
JavaScript
js
const range = document.createRange();
range.setStartBefore(document.getElementsByTagName("em").item(0), 0);
range.setEndAfter(document.getElementsByTagName("em").item(1), 0);
document.getElementById("log").textContent = range.toString();
Ergebnis
Spezifikationen
Specification |
---|
DOM # dom-range-stringifier |
Browser-Kompatibilität
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
toString |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.