开发者

How to get caret horizontal position in contenteditable element?

开发者 https://www.devze.com 2023-03-11 01:42 出处:网络
I have a contenteditable element (div) which contains some text and html. I need to find horizontal position of the caret on current line. I need number which is relative to each line that is within t

I have a contenteditable element (div) which contains some text and html. I need to find horizontal position of the caret on current line. I need number which is relative to each line that is within this contenteditable element. I know how to get absolute position of 开发者_JAVA技巧the caret in whole contenteditable but I am looking for position on current line. Can anybody help ? Preferably using jQuery.

0

精彩评论

暂无评论...
验证码 换一张
取 消