mirror of
https://github.com/bendtherules/UiQuestions.git
synced 2026-08-19 00:30:59 +00:00
create-modify-element - Use MDNBadge instead of mdn links
This commit is contained in:
@@ -8,6 +8,7 @@ slug: /
|
|||||||
|
|
||||||
import Admonition from "../components/Admonition"
|
import Admonition from "../components/Admonition"
|
||||||
import Accordion from "../components/Accordion"
|
import Accordion from "../components/Accordion"
|
||||||
|
import MDN from "../components/MDNBadge"
|
||||||
|
|
||||||
## Finding elements
|
## Finding elements
|
||||||
|
|
||||||
@@ -36,7 +37,7 @@ document.querySelector(".not-found"); // null
|
|||||||
</Admonition>
|
</Admonition>
|
||||||
</Accordion>
|
</Accordion>
|
||||||
|
|
||||||
[Read on MDN](https://developer.mozilla.org/en-US/docs/Web/API/Element/querySelector)
|
<MDN title="querySelector" url="https://developer.mozilla.org/en-US/docs/Web/API/Element/querySelector" />
|
||||||
|
|
||||||
### 2. `querySelectorAll()`
|
### 2. `querySelectorAll()`
|
||||||
|
|
||||||
@@ -58,7 +59,7 @@ for (var p of paras) {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
[Read on MDN](https://developer.mozilla.org/en-US/docs/Web/API/Element/querySelectorAll)
|
<MDN title="querySelectorAll" url="https://developer.mozilla.org/en-US/docs/Web/API/Element/querySelectorAll" />
|
||||||
|
|
||||||
## Create / insert element
|
## Create / insert element
|
||||||
|
|
||||||
@@ -88,7 +89,7 @@ document.createElement("div")
|
|||||||
</Admonition>
|
</Admonition>
|
||||||
</Accordion>
|
</Accordion>
|
||||||
|
|
||||||
[Read on MDN](https://developer.mozilla.org/en-US/docs/Web/API/Document/createElement)
|
<MDN title="createElement" url="https://developer.mozilla.org/en-US/docs/Web/API/Document/createElement" />
|
||||||
|
|
||||||
### 2. `setAttribute()`
|
### 2. `setAttribute()`
|
||||||
|
|
||||||
@@ -105,8 +106,8 @@ var ele = document.createElement("input")
|
|||||||
ele.setAttribute("type", "text")
|
ele.setAttribute("type", "text")
|
||||||
// <input type="text"/>
|
// <input type="text"/>
|
||||||
```
|
```
|
||||||
|
<MDN title="setAttribute" url="https://developer.mozilla.org/en-US/docs/Web/API/Element/setAttribute" />
|
||||||
|
|
||||||
[Read on MDN](https://developer.mozilla.org/en-US/docs/Web/API/Element/setAttribute)
|
|
||||||
|
|
||||||
### 3. `appendChild()`
|
### 3. `appendChild()`
|
||||||
|
|
||||||
@@ -146,4 +147,4 @@ eleDiv.appendChild(eleH1)
|
|||||||
</Admonition>
|
</Admonition>
|
||||||
</Accordion>
|
</Accordion>
|
||||||
|
|
||||||
[Read on MDN](https://developer.mozilla.org/en-US/docs/Web/API/Node/appendChild)
|
<MDN title="appendChild" url="https://developer.mozilla.org/en-US/docs/Web/API/Node/appendChild" />
|
||||||
Reference in New Issue
Block a user