create-modify-element - Cleanup setAttribute section

This commit is contained in:
2020-10-15 22:56:21 +05:30
parent f03d7ebf06
commit 0630954a14
+5 -3
View File
@@ -92,10 +92,12 @@ document.createElement("div")
### 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"`.
`value` - value of the attribute. Ex- `"text"`.
`setAttribute(name, value)`
`name` - name of the attribute to add. Ex- "type".
`value` - value of the attribute. Ex- "text".
```js
var ele = document.createElement("input")