How through JS determine the breadth of the block?



  • There are three blocks in the labour field.
    One text and width:auto;
    How to determine its breadth and breadth of the work area through JS?



  • The simplest option in the net JS is:

    var width = document.getElementById('foo').offsetWidth;
    

    If you use the jQuery library, the code will be a little easier:

    var width = $('#foo').width();
    



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2