Reputation: 42208
When I run following code:
node = $('.period')
alert(node.width() + ' ' + node.css('width'))
i get '0 144px'. How is that possible?
Upvotes: 4
Views: 8615
Reputation: 25791
Maybe you're calling it on $(document).ready, and as width() Gets the current computed, pixel, width of the first matched element., it'd be 0 as it has not been rendered yet...
css('width') however reads from the css stylesheet, which would be already available.
Upvotes: 14