我有div,它是通过插件对文本输入字段进行处理的。另外,这些div也是可拖动的。
现在,我已经知道,如果你拖动div,它就会被拖动,如果你只是点击它,它就会得到一个".focus()“。
现在的问题是,如果我点击它一次,我就会得到它的焦点。但是光标会跳到行首。
我想要的,是光标在我点击的地方。
我如何使用jquery做到这一点?谢谢
编辑(我的JS代码):
$('.mydiv').click(function(){
//actually, it does not focus on "$(this)" but on a div insid
我需要将焦点设置在输入字段上。 按下按钮后,这个方法对我有效。 function createNewDiv() {
document.getElementById('myButton').blur(); ---- here I remove the focus from the button. Because the browser writes an error that an element with focus already exists
const body = document.createElement('te
当用户输入错误的确认密码并移出输入字段时,将显示工具提示消息,但当用户再次将焦点移到确认密码输入字段内时,工具提示消息仍保留在那里。我正在尝试让它在用户移动焦点/光标到该框内时消失。
<div *ngIf="(registerForm.controls.c_password.touched) && (registerForm.controls.password.value !== registerForm.controls.c_password.value)">
<div data-tip="Passwords do not m
我使用下面的代码将焦点设置为文本字段:
public void setFieldInFocus(TabPage tabPage)
{
foreach (Control t in tabPage.Controls)
{
if (t is TextBox)
{
if (t.Name == fieldInFocus)
{
t.Focus();
}