-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
52 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
--- | ||
title: "HTMLAnchorElement: text プロパティ" | ||
short-title: text | ||
slug: Web/API/HTMLAnchorElement/text | ||
l10n: | ||
sourceCommit: bb48907e64eb4bf60f17efd7d39b46c771d220a0 | ||
--- | ||
|
||
{{ApiRef("HTML DOM")}} | ||
|
||
**`text`** は {{domxref("HTMLAnchorElement")}} のプロパティで、要素内のテキストを表します。 | ||
このプロパティは {{domxref("Node.textContent")}} と同じ情報を表します。 | ||
|
||
## 値 | ||
|
||
文字列です。 | ||
|
||
## 例 | ||
|
||
```html | ||
<a id="exampleLink" href="https://example.com">Example Link</a> | ||
<p class="text"></p> | ||
``` | ||
|
||
```css | ||
#exampleLink { | ||
font-size: 1.5rem; | ||
} | ||
``` | ||
|
||
```js | ||
const anchorElement = document.getElementById("exampleLink"); | ||
const pTag = document.querySelector(".text"); | ||
pTag.textContent = `Text property: ${anchorElement.text}`; | ||
``` | ||
|
||
### 結果 | ||
|
||
{{EmbedLiveSample("Example",100,100)}} | ||
|
||
## 仕様書 | ||
|
||
{{Specifications}} | ||
|
||
## ブラウザーの互換性 | ||
|
||
{{Compat}} | ||
|
||
## 関連情報 | ||
|
||
- {{domxref("HTMLScriptElement.text")}} プロパティ | ||
- {{domxref("HTMLOptionElement.text")}} プロパティ |