Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR HTML

append button in div

<script>
  // Create element:
  const btnn = document.createElement("button");
  btnn.innerHTML = "Toggle";

  // Append to another element:

  const hh = document.querySelector(".hl_controls");
  hh.appendChild(btnn);
  btnn.setAttribute("id", "ToggleBtn");

  const b = document.querySelector("body");
  b.setAttribute("id", "bodyOpen");

  document.getElementById("ToggleBtn").onclick = function () {
    rogiFunction();
  };

  function rogiFunction() {
    document.getElementById("ToggleBtn").classList.toggle("BtnToggleClass");
    b.classList.toggle("BToggleClass");
  }
</script>

add in header or footer

For
Divi > theme option > integration > Add code to the head of your blog

For
Elementor install new plugin
https://wordpress.org/plugins/custom-css-js/
add html file in head and paste this code and save it


Rogi Network
+923022020318
http://roginetwork.com/
Source by roginetwork.com #
 
PREVIOUS NEXT
Tagged: #append #button #div
ADD COMMENT
Topic
Name
1+7 =