检查字段内容是否通过程序更改。会触发什么事件
我有一个密码字段,因为它里面有字段名称,所以它以 input="text"
开头。当用户键入或单击它时,该字段会交换为 input="password"
。
我们的一些用户将他们的用户名/密码存储到第三方程序中。由于密码是通过其函数之一写入该字段,因此我的密码字段不会交换为密码,因为没有针对它触发的事件。
第三方人员并不积极,只是说“强硬”。
我正在考虑执行 setInterval
来检查内容,但这不够立即。
如果输入字段的内容通过函数更改,则任何人都会触发任何事件。同样,我无法控制输入密码的功能。
任何建议都会有所帮助。我觉得这似乎是一个失败的事业。顺便说一句,我不能使用 jQuery,因为它不是我们网站上认可的技术。但是,如果有 jQuery 解决方案,我可以看看我能做什么。
I have a password field that, because it has it's field name inside it, begins as an input="text"
. When the user types or clicks on it, the field swaps out to input="password"
.
Some of our users store their username/password into a 3rd party program. Because the password is being written into the field via one of their functions, my password field isn't swapping out to a password because there's no event firing against it.
The third party folks aren't on the ball and really just said, "tough".
I was thinking of doing a setInterval
to check the contents, but this will not be immediate enough.
Does anyone if any event fires if the contents of an input field is changing via a function. Again, I have no control over the function that is inputting the password.
Any suggestions would be a help. I feel as if this is a lost cause. BTW, I can't use jQuery because it's not an approved technology on our site. But, if there is a jQuery solution, I can see what I can do.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对于你的情况,你可以颠倒你的逻辑。您可以将该字段作为“密码”启动,然后在 setTimeOut 上检查它的值是否为“密码”。如果是,请将其设置为“文本”。
(您可以进一步使用“onchange”和后端验证来禁止单词
password
作为密码)For your situation, you could reverse your logic. You can start the field as "password", then on setTimeOut, check if it has a value of 'password'. If it does, set it to "text".
(You could further use 'onchange' and backend validation to disallow the word
password
as a password)