Answers for "add class to body js"

0

add classnames to body

openModal = (event) => {
  document.body.classList.add('modal-open');
  this.setState({ showModal: true });
}
hideModal = (event) => {
  document.body.classList.remove('modal-open');
  this.setState({ showModal: false });
}
Posted by: Guest on February-14-2020
0

add class to body javascript

var body = document.body;

body.classList.add("body_class");
Posted by: Guest on December-03-2020
4

add class to element javascript

element.classList.add('class');
element.classList.remove('class');
Posted by: Guest on July-15-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language