Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
希望有人可以帮助 jquery numpad。问题是,当您单击输入字段并单击数字时,代码会重复。我的意思是有两个输入字段,当您键入时,数字会复制到另一个输入字段中。请检查 Fiddle,谢谢您的帮助。
添加以下内容,将元素设置var为单击数字时要使用的 a:
var
var lastFocused; $('input').on('focusin', function() { lastFocused = $(this); });
在所有id选择器上替换$(lastFocused)为设置/删除/清除最后聚焦的输入值。
id
$(lastFocused)
更新小提琴:https ://jsfiddle.net/ffshgn6g/15/