set visibility js code example
Example 1: how to edit the visibiility of an element javscript
const element = document.getElementById("id");
element.style.visibility = "hidden";
element.style.visibility = "visible";
const visible = element.style.visibility;
Example 2: js set visibility hidden
Check this! https://dev.to/devlorenzo/js-hide-and-show-32og
Example 3: manipulating visibility using js
function toggleClock() {
var myClock = document.getElementById('clock');
var displaySetting = myClock.style.display;
var clockButton = document.getElementById('clockButton');
if (displaySetting == 'block') {
myClock.style.display = 'none';
clockButton.innerHTML = 'Show clock';
}
else {
myClock.style.display = 'block';
clockButton.innerHTML = 'Hide clock';
}
}