mirror of
https://github.com/bendtherules/UiQuestions.git
synced 2026-08-18 13:52:50 +00:00
create-modify-element - Cleanup setAttribute section
This commit is contained in:
@@ -92,10 +92,12 @@ document.createElement("div")
|
|||||||
|
|
||||||
### 2. `setAttribute()`
|
### 2. `setAttribute()`
|
||||||
|
|
||||||
Every element has a `.setAttribute(name, value)` method, which can add/modify a attribute on the current element.
|
Every element has a `setAttribute` method - which sets a attribute on the current element.
|
||||||
|
|
||||||
`name` - the attribute name which should be added. Ex- `"type"`.
|
`setAttribute(name, value)`
|
||||||
`value` - value of the attribute. Ex- `"text"`.
|
|
||||||
|
`name` - name of the attribute to add. Ex- "type".
|
||||||
|
`value` - value of the attribute. Ex- "text".
|
||||||
|
|
||||||
```js
|
```js
|
||||||
var ele = document.createElement("input")
|
var ele = document.createElement("input")
|
||||||
|
|||||||
Reference in New Issue
Block a user