When I use the following :
div = '<div class="tag-tooltip" id="tooltip_view_1">First item</div>';
$('#products').append(div);
var tooltip_width = $('开发者_如何学编程#tooltip_view_1').width();
var tooltip_height = $('#tooltip_view_1').height();
The tooltip_height gives a correct value, while tooltip_width returns 0. Any idea why is this happening and what should I do to get the width of the newly created element?
Just to say I've solved the problem - it appears css property : text-indent is also affecting visibility of the element. I had it set to the negative value and once removed this property altogether - everything started working fine.
精彩评论