add / remove class name / attribute to html

PHOTO EMBED

Wed Nov 10 2021 15:42:55 GMT+0000 (UTC)

Saved by @KarenStewart #javascript #react.js

let dog = document.querySelector("p .dog");
dog.classList.add("cat");
dog.classList.remove("<strong>dog</strong>");


//attribute
let weatherIconElement = document.querySelector("#weather-icon");
  weatherIconElement.setAttribute(
    "src",
    `http://www.openweathermap.org/img/wn/${response.data.weather[0].icon}@2x.png`
  );
  weatherIconElement.setAttribute("alt", response.data.weather[0].description);
content_copyCOPY