问题标签 [focusin]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
jquery - jquery focusout不添加文本回来
我有一个文本区域,在页面加载时有一些文本。当有人点击它时,我希望该文本消失。当他们点击退出时,如果他们没有输入任何内容,我希望文本返回,但如果他们没有任何事情发生。文本是“在此处键入您的答案”。这就是我所拥有的,可用于在单击时删除文本,但如果他们没有键入任何内容,则不能将其重新添加。
非常感谢您对此的任何帮助。
jquery - jQuery 聚焦/聚焦。避免关注提交
我有这个小脚本可以在关注表单时切换笑脸:
但是,当我click 'submit'
回到该focusout
州时。我该如何避免呢?
javascript - 使用未触发的焦点事件
我正在尝试对foucsin
文本框执行一些操作。但是,由于某种原因,该事件永远不会触发。
jquery - jQuery:focusin 和 keydown 多次迭代每个函数
我有一个无序列表,当它被选中时有一个荧光笔。只有当红色 div 框处于焦点时才能使用向上和向下箭头键选择。
这是代码 http://jsfiddle.net/X3vLP/
对于第一个焦点,它工作得很好,可以在列表中上下移动。从第二个焦点开始时会出现问题,它会跳过列表中的一些选择。
我也尝试过下一个和上一个功能
它仍然产生相同的东西。有什么解决办法吗?
jquery - jquery focusout不同的事件取决于你接下来关注的地方
我有一个带有文本输入字段 $newItemField 的列表,默认值 =“新项目”。通过单击输入按钮 $addButton 您可以将 $newItemField 的值添加到列表中。
当 .focusin $newItemField 我删除默认值 this.value = "";
当 .focusout 与 $newItemdField = "" 我将默认值重置为 $newItemField = "New Item"。两者都工作得很好。
我的问题是,如何将 .focusout 与特定输入字段的 .focusin 结合起来。换句话说,当 .focusout wuth $newItemField = "" 我只想在没有点击 $addButton 时重置默认值????
现在发生的情况是,当 $newItemField ="" 并单击 $addButton 时,.focusout 首先起作用($newItemField = "New Item"),然后我将一个名为“New Item”的项目添加到列表中。这就是我想防止发生的事情。
我尝试了很多使用 if 和 click(),但没有成功。我将不胜感激下面对我的代码的任何形式的支持。
在威廉的回答之后,我的变化如下。现在,无论 .activeElement 关注后,§newItemField 都不会显示任何值。换句话说,没有我在不点击添加按钮时错过了默认值“新项目”。
javascript - Changing focus over an overflow:hidden contained element, moves it but makes unnoticeable that difference
I have a container with overflow:hidden. Inside it, there is a table with some input within. When you change the focus from input to input, the table element moves to make visible the element, but there is no trace of that change (at least I can't see it) to capture how much it have been moved.
I need that position because I'm developing a kind of scroll, and the scroll bar should move accordingly to the element.
P.S.: The problem is just to get the position info, cause I trigger .focusin() event but there is nothing to retrieve
Thanks!!!
jquery -
这是HTML:
这是CSS:
点击它不会做任何事情。
好的,我想,我会选择 jQuery。
它也没有帮助。但是,如果 $('legend') 听“click”,它会做它应该做的事情。是什么赋予了?
jquery - 选择 onfocusin 做某事不起作用
我正在尝试使用 AJAX 加载稍后显示在页面上的一些输入和选择。我正在做这样的事情。
对于从页面呈现开始就存在的选择和输入,结果是可以的,但对于稍后出现的元素则不行。有谁知道这里发生了什么?谢谢!
javascript - 验证输入框,使用 Jquery focusin 函数不起作用
我正在为在网站上创建新帐户的人制作验证表格。当用户输入第二个输入框时,如果第一个输入框(用户名)为空或数据库中已有相同的用户名,他们将收到错误消息。当他们开始输入第二个输入框时如何显示错误消息?我用了focusin,但没有用。你可以帮帮我吗??
javascript - 为什么 focusout 缺少选定的选项?
我正在使用 jquery focusin 和 focusout 来扩展和最小化表单上的多个选项选择:
一切都很好,当它获得焦点时会展开 1 行下拉列表,选择一个或多个选项,然后移至表单上的下一个字段。但是当返回下拉并再次关注它时,之前选择的选项会丢失。请有任何想法。