How to use width() Method in JQuery

In this article, I will explain use of width () Method in JQuery.
  • 1851

JQuery CSS width() Method

  • width () method method set and return the height of selected elements.




The following example shows how to width() method in jquery.

<!DOCTYPE html>



<script type="text/javascript" src="jquery.js"></script>

<script type="text/javascript">

    $(document).ready(function () {

        $("button").click(function () {

            alert("Width is "+$("p").width());






<p>width() Method Example</p>

<button>Click for Get the width</button>





width simple.jpg

Further Readings

You may also want to read these related articles here

Ask Your Question 

Got a programming related question? You may want to post your question here

Programming Answers here

© 2020 DotNetHeaven. All rights reserved.