Get Browser Screen Width and Height dynamically using jquery

In order to get screen width and height of your browser window using jQuery check out the below code. As you resize your browser window the values of the width and height of the frame is displayed.

This code can be quite handy when your testing your responsive design of your website. You can view this page on various devices to get the height and width.

<!DOCTYPE html>
<script type="text/javascript" src="../js/jquery-1.10.2.min.js" >
#display {
        width: auto;
        background-color: #ccc;
        color: #222;
        margin-left: 5px;
        text-align: center;
$("#display").html("<b>Width</b> : " + 
       $(window).width() + ",<b>Height : </b>" +
$(window).resize(function() {
        $("#display\").html("<b>Width</b> : " +
        $(window).width() + ",<b>Height : </b>" +
<div id="display"></div>
Get Browser width and height using jQuery
Get Browser width and height using jQuery

Note: There is an easier way to do this using Chrome browser Inspect option, Right Click on any web-page and click on Inspect, click on "Toggle Device toolbar" and select responsive option, drag the width and height to know how your page renders and what the page dimensions are.