我有以下 img 标签:
<img id="product-image" src="http://cf.test.com/images/store_logos/thumbnail/43f1ee4d5fe422e9440ab4afe065bbff899b24b0.jpg" width="228" height="304" style="opacity: 1;">
试图提取出 304 高度值:
$('#product-image').height();
但是它总是给我图像的实际大小。 有什么想法吗?
最佳答案
试试这个
$(document).ready(function(){
alert("Width :"+$('#product-image').width());
});
关于javascript - 我如何使用 jQuery 获取 <img> 标签内的宽度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17161030/