I am looking to adjust the padding of my header to give it a sleeker appearance on the page. I attempted to achieve this with the code below, but it seems to have no effect:
function openPage() {
var i, el = document.getElementById('headbar');
for(i=0;i<30;i++) {
el.style.paddingTop = el.style.paddingTop + 1;
}
}
During my troubleshooting efforts in the console, I realized that specifying pixels is essential for the padding to change as shown by the following successful code snippet:
document.getElementById('headbar').style.paddingTop='100px';
Is there a way to accomplish this without using jQuery and avoiding string manipulation?