[英]contenteditable, set caret at the end of the text (cross-browser)
[英]Trying to put caret (cross-browser) at the end of line on focus
考慮以下contenteditable
元素
<div contenteditable>
Foo bar <span contenteditable="false"></span>x</div>
現在,這里發生的一件好事是,無論您使用哪種瀏覽器,如果單擊內部的某個位置,插入號始終位於x
后面。
但是,因為我不想在行尾加上x
,而又刪除了x
,所以插入標記放置位置的行為是不同的(野生動物園和Edge做奇怪的事情)。 因此,我發現當contenteditable
的最后一行以不可編輯的span
結尾時,您會遇到問題,所以我做了
<div contenteditbale>Foo Bar <span con...="false"><span></span></div>
相同的行為實際上根本沒有幫助。 看來插入符號不會顯示在空白范圍內
任何建議如何解決此問題?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.