The Little Guy Posted August 12, 2008 Share Posted August 12, 2008 How come with this code, my alert is blank? the element dragger does exist too. var width = document.getElementById('dragger').style.width; alert(width); Link to comment https://forums.phpfreaks.com/topic/119386-solved-get-elemnt-width/ Share on other sites More sharing options...
lemmin Posted August 12, 2008 Share Posted August 12, 2008 Because the width was never set. Link to comment https://forums.phpfreaks.com/topic/119386-solved-get-elemnt-width/#findComment-615044 Share on other sites More sharing options...
The Little Guy Posted August 12, 2008 Author Share Posted August 12, 2008 It is set in my CSS, any who, I found out how: var width = document.getElementById('dragger').clientWidth; var height = document.getElementById('dragger').clientHeight; Link to comment https://forums.phpfreaks.com/topic/119386-solved-get-elemnt-width/#findComment-615077 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.