The predefined width() method in Jquery lets you know the width of the browser window.
<!DOCTYPE html>
<html>
<head>
<title>Jquery width()</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
</head>
<body>
<button>CHECK CURRENT WINDOW WIDTH</button>
<script>
$(document).ready(function(){
$("button").click(function(){
var width=$(window).width();
alert("Width of the window is - "+width);
});
});
</script>
</body>
</html>
Publish A Comment