[英]Nativescript Detect Focus Change On TextField - Code Behind
So I am creating a textField through code behind in Nativescript Javascript. 所以我正在通过Nativescript Javascript中的代码创建一个textField。
I wanna create an event so when the focus on a field changes I can detect it. 我想创建一个事件,以便当对某个领域的关注发生变化时,我可以检测到它。
I have tried: 我努力了:
textFieldName.focus = "onFocus";
function onfocus(args){
console.log("Ping");
}
But nothing happens. 但是什么也没发生。
How do I bind the focus event through javascript, so I can detect when a field gets focus and loses focus? 如何通过javascript绑定焦点事件,以便可以检测字段何时获得焦点而失去焦点?
Thanks 谢谢
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.