Using JavaScript I need to find an element that has position fixed and set its top attribute to 60px.
const myDiv = document.querySelector('.my-div')
if(myDiv && myDiv.style.position == 'fixed') {
myDiv.style.top = '60px';
}
But it doesn't work. What is wrong in my code?