I am obtaining <p>'s width. The <p> is placed inside a <div> container with an <input> next to it. The <div> and all its contents were dynamically added to the DOM just before obtaining the width.
<div id="text-0">
<p>name</p>
<input>
</div>
<p>'s width if I look at the $(p) object properties in console is 35 (offsetWidth, clientWidth), but $(p).width() in the code returns 162, which is the width of the input element next to it. Same values are returned by all the methods $(p).innerWidth(), $(p).outerWidth(), p.offsetWidth, p.clientWidth, p.getBoundingClientRect()