检查字段内容是否通过程序更改。会触发什么事件

发布于 2024-10-12 19:20:44 字数 424 浏览 9 评论 0原文

我有一个密码字段,因为它里面有字段名称,所以它以 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

花之痕靓丽 2024-10-19 19:20:45

对于你的情况,你可以颠倒你的逻辑。您可以将该字段作为“密码”启动,然后在 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)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文