jQuery innerWidth Method


jQuery innerWidth Method : is used to get the width of selected element including the padding.


jQuery innerWidth Method Syntax

$(selector).innerWidth();

jQuery innerWidth() Method Example

<script type="text/javascript">
         $(document).ready(function(){ 
              $( "#widthExample" ).on( "click", function(event) {             
                  var x = $("#myDiv").innerWidth();       
                          $("#myDiv > p").html("Inner Width = "+x+"px");     
              });
               
          });
</script>

Try it »

The Output of the above example is given below which is showing the inner width of the div. This method can be used to find inner width of any element:
Note : It returns the width of element including the padding.

jQuery innerWidth Method

jQuery innerWidth Method


Advertisements

Add Comment

📖 Read More