javascript - getting the size of a content box with javascriptHey -


this question has answer here:

i trying width of content box following comand:

var box = document.getelementbyid('player'); var boxsize = box.clientwidth; 

it seems return something. when alert it gives out number. still throws error:

uncaught typeerror: cannot read property 'clientwidth' of null 

what happening here?

var box = document.getelementbyid('player'); if(box){   var boxsize = box.offsetwidth; } 

Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -