body { background:yellow; }
button { font-size:12px; margin:2px; }
p { width:150px; border:1px red solid; }
div { color:red; font-weight:bold; }
<script src="https://code.jquery.com/jquery-latest.js"></script>
<button id="getp">Get Paragraph Width</button>
<button id="getd">Get Document Width</button>
<button id="getw">Get Window Width</button>
Sample paragraph to test width
function showWidth(ele, w) {
$("div").text("The width for the " + ele +
$("#getp").click(function () {
showWidth("paragraph", $("p").width());
$("#getd").click(function () {
showWidth("document", $(document).width());
$("#getw").click(function () {
showWidth("window", $(window).width());