clientLeft property is used to find the width between the left border and the element.
If the elements text direction is right-to-left, and the element contains scrollbar in left side it will also be added.
When calculating, left margin and padding are not added.
var elem = element.clientLeft;
Example - Get clientLeft of an element
- In the above example we have created a div (idDiv), and have specified border for the element.
- When the button is clicked, fun_name function is called.
- Using the clientLeft property, width between the left border and the element is calculated and displayed (alert(elem.clientLeft)).