Uncaught TypeError: Cannot read property 'style' of undefined

"element[0].style.width" does not exist, causes a uncaught type error. Using "element.style.width" fixes the problem