I'm trying to set top using java script. I logged the top of the menu after adding top style, but it does not work.
How to style top using js??
Here is my codes
const top = (document.getElementById(element).offsetTop);
top is a number not String
document.getElementById('contentMenu').style.top = top.toString();
console.log("menu" +document.getElementById('contentMenu').style.top); //output: menu
px,emor%.topvariable in your script is global, then it refers to the topmost browser window.window.topis a non-configurable DOM property, you should see an error on the lineconst top = ....