How to make jQuery to not round value returned by .width()?

后端 未结 5 1306
猫巷女王i
猫巷女王i 2020-11-28 05:30

I\'ve searched around and couldn\'t find this. I\'m trying to get the width of a div, but if it has a decimal point it rounds the number.

Example:

         


        
5条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-11-28 06:21

    Use the following to get an accurate width:

    var htmlElement=$('class or id');
    var temp=htmlElement[0].style.width;
    

提交回复
热议问题