知道 jQuery Caret 插件,我仍然看不到以下方法带有 JavaScript 的 HTML 中的单行文本框(即 input:type=text 控件):
Knowing the jQuery Caret plugin, I'm still seeing no way to do the following on a single line text box in HTML (i.e. the input:type=text control) with JavaScript:
我知道怎么做 1. 和 2.,只是为了 3. 我没有找到办法.
I know how to do 1. and 2., just for 3. I have found no way of doing it.
举例说明:
我的问题是:
有什么方法可以可靠地将插入符号放在文本的末尾并将其滚动到视图中?
Is there any way to reliable put the caret at the end of the text and scroll it into the view?
(我可以考虑模拟按下 END 键或类似的东西,但我不确定这是否是最佳选择).
(I can think of simulating pressing the END key or something like that, but I'm unsure whether this would be the best option).
//hack to get cursor at end:
//hack to get cursor at end:
$(textboxselector).val($(textboxselector).val());
应该首先注意焦点:
$(textboxselector).val(newtext);
$(textboxselector).focus();
$(textboxselector).val($(textboxselector).val());
这篇关于可以使用 JavaScript 将插入符号滚动到单个 HTML 文本字段内的视图中吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
检查一个多边形点是否在传单中的另一个内部Check if a polygon point is inside another in leaflet(检查一个多边形点是否在传单中的另一个内部)
更改传单标记群集图标颜色,继承其余默认 CSSChanging leaflet markercluster icon color, inheriting the rest of the default CSS properties(更改传单标记群集图标颜色,继承其余默认
触发点击传单标记Trigger click on leaflet marker(触发点击传单标记)
如何更改 LeafletJS 中的默认加载磁贴颜色?How can I change the default loading tile color in LeafletJS?(如何更改 LeafletJS 中的默认加载磁贴颜色?)
将 Leaflet 图层控件添加到侧边栏Adding Leaflet layer control to sidebar(将 Leaflet 图层控件添加到侧边栏)
Leaflet - 在弹出窗口中获取标记的纬度和经度Leaflet - get latitude and longitude of a marker inside a pop-up(Leaflet - 在弹出窗口中获取标记的纬度和经度)