Get width and height of element

Discussion in 'ASP .Net' started by Alejandro Penate-Diaz, May 2, 2005.

  1. Hi. Is there any way of getting an element real size from javascript, when
    this element was previously assigned a width and height of 100%?
    Thanks,
    Alex.
     
    Alejandro Penate-Diaz, May 2, 2005
    #1
    1. Advertising

  2. In IE you can use the getBoundingRect() method. Look ut up on MSDN for
    documentation and examples. In most cases, you can use offsetHeight and
    offsetWidth of the element, like

    var e = document.getElementById("myDiv");
    alert(e.offsetHeight);
    alert(e.offsetWidth);
     
    Johan Nordberg, May 2, 2005
    #2
    1. Advertising

  3. Alejandro Penate-Diaz

    Sambathraj Guest

    Sambathraj, May 2, 2005
    #3
  4. Alejandro Penate-Diaz

    suresh44t

    Joined:
    Jan 5, 2013
    Messages:
    1
    yes you can do this with the help of jQuery.


    $(document).ready(function(){
    $("div.width").append($("div.width").width()+" px");
    $("div.innerWidth").append($("div.innerWidth").innerWidth()+" px");
    $("div.outerWidth").append($("div.outerWidth").outerWidth()+" px");
    });
     
    suresh44t, Jan 5, 2013
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. AndrewF
    Replies:
    1
    Views:
    822
    Bruce Barker
    Oct 10, 2005
  2. Lois
    Replies:
    1
    Views:
    3,374
    Ryan Stewart
    Dec 27, 2004
  3. cera
    Replies:
    1
    Views:
    1,326
    Neredbojias
    Aug 18, 2007
  4. Bernd Meier
    Replies:
    6
    Views:
    535
    GTalbot
    Jan 14, 2008
  5. Dario de Judicibus

    width and height of an element

    Dario de Judicibus, Feb 4, 2004, in forum: Javascript
    Replies:
    0
    Views:
    138
    Dario de Judicibus
    Feb 4, 2004
Loading...

Share This Page