crop_rotate
Run
<!DOCTYPE html> <html> <head> <title>setAttribute JavaScript</title> </head> <body> <h1>Welcome To Dom</h1> <p id="apple"> Get element by id name</p> <p class="text"> Get elements by class name</p> <p class="text"> Get elements by tag name</p> <p class="text"> Get elements by name</p> <hr> <script> let apple = document.getElementById('apple'); document.write("get class value before add : " + apple.getAttribute('class')); document.write("<br>"); apple.setAttribute('class','memory'); document.write("New class value : " + apple.getAttribute('class')); </script> </body> </html>
PCFET0NUWVBFIGh0bWw+DQo8aHRtbD4NCjxoZWFkPg0KPHRpdGxlPnNldEF0dHJpYnV0ZSBKYXZhU2NyaXB0PC90aXRsZT4NCjxzdHlsZSB0eXBlPSJ0ZXh0L2NzcyI+IDo6LXdlYmtpdC1zY3JvbGxiYXJ7d2lkdGg6N3B4O2hlaWdodDo3cHg7fTo6LXdlYmtpdC1zY3JvbGxiYXItdHJhY2t7YmFja2dyb3VuZDojZmZmO306Oi13ZWJraXQtc2Nyb2xsYmFyLXRodW1ie2JvcmRlci1yYWRpdXM6NXB4O2JhY2tncm91bmQ6IzJmNDVmZjt9PC9zdHlsZT48L2hlYWQ+DQo8Ym9keT4NCiAgIDxoMT5XZWxjb21lIFRvIERvbTwvaDE+DQogICA8cCBpZD0iYXBwbGUiPiBHZXQgZWxlbWVudCBieSBpZCBuYW1lPC9wPg0KICAgPHAgIGNsYXNzPSJ0ZXh0Ij4gR2V0IGVsZW1lbnRzIGJ5IGNsYXNzIG5hbWU8L3A+DQogICA8cCAgY2xhc3M9InRleHQiPiBHZXQgZWxlbWVudHMgYnkgdGFnIG5hbWU8L3A+DQogICA8cCAgY2xhc3M9InRleHQiPiBHZXQgZWxlbWVudHMgYnkgbmFtZTwvcD4NCiAgIDxocj4NCiAgICA8c2NyaXB0Pg0KICAgICAgICBsZXQgYXBwbGUgPSBkb2N1bWVudC5nZXRFbGVtZW50QnlJZCgnYXBwbGUnKTsNCiAgICAgICAgZG9jdW1lbnQud3JpdGUoImdldCBjbGFzcyB2YWx1ZSB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