Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to Get height width or element using Jquery

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 396
    Comment on it

    Hello reader's,
    Below is the example for Getting height width or element using Jquery
    If you having trouble with such issues, then use the below code to resolve such issues.

    Here is the HTML

    <button id="dummy-height">Get div Height or width</button>
    <button id="dummy-width">Get Document width</button>
    
    <div>&nbsp;</div>
    
    <p>
       <img class="dummy-profile" src="http://jp-australia.com/2013/sup/wp-content/themes/jp-australia/img/rider&#95;profile-image&#95;dummy.png">
    </p>
    


    Here is the css

    button {
          font-size: 14px;
          margin: 2px;
          padding:7px; 
     }
    
    div {
          color: red;
          font-weight: bold;
    }
    

    Here is the js

    function showHeightwidth( element, height ) {
      $( "div" ).text( "The height for the " + element + " is " + height + "px." );
    }
    $( "#dummy-height" ).click(function() {
      showHeightwidth( "dummy-profile", $( ".dummy-profile" ).height() );
    });
    $( "#dummy-width" ).click(function() {
      showHeightwidth( "dummy-profile", $( ".dummy-profile" ).width() );
    });
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: