Answers for "add class to body tag javascript"

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

javascript add div to body with class

// correct me if im wrong
var MainDiv = document.createElement('div');
var ChildDiv1 = MainDiv.createElement('div');
ChildDiv1.className = 'contextmenu_contextMenu_3_a2Z contextmenu_ContextMenuFocusContainer_2thYU';
ChildDiv1.tabIndex = "0";
ChildDiv1.style = "visibility: visible; bottom: 56px; right: 68px;"
var ChildDiv2 = ChildDiv1.createElement('div');
ChildDiv1.className = 'contextmenu_contextMenuContents_1yyTu';
var DivButton1 = ChildDiv2.createElement('div');
DivButton1.className = 'contextmenu_contextMenuItem_CBC-y contextMenuItem';
DivButton1.value = "Upload an Image";
var DivButton2 = ChildDiv2.createElement('div');
DivButton2.className = 'contextmenu_contextMenuItem_CBC-y contextMenuItem';
DivButton2.value = "Share Your Trade Offer URL";
document.body.appendChild(MainDiv);
Posted by: Guest on September-03-2020

Code answers related to "add class to body tag javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language