jQuery API jQuery API 中英文对照版 - jQuery在线查询手册
width()

width()

Returns the css width value for the first matched element. If used on document, returns the document's width (innerWidth) If used on window, returns the viewport's (window) width

返回值

Object

示例

jQuery 代码:
$("#testdiv").width()
结果:
"200px"
jQuery 代码:
$(document).width();
结果:
800

jQuery 代码:

$(window).width();
结果:
400