SoFunction
Updated on 2025-02-28

Solution to display prompt information in password form under js

Someone wants this code in classics. Considering that the content input in password will be displayed as *, we need to find a way to solve the problem of *. I wanted to use setAttribute to dynamically modify the type attribute to achieve the effect, and then the test was successful under ff, but I didn't expect that the modification of the type attribute by setAttribute is invalid in ie. Finally, this was solved by using the background image. That is, set a background image for password, and the text of the image is prompt information
For example: <img src="/upload/" />,
The background image is not displayed when the mouse is placed.
The code is as follows:

[Ctrl+A Select all Note:Introducing external Js requires refreshing the page before execution]