JavaScript implementation input box (Password box) prompts, javascript input box

Source: Internet
Author: User

JavaScript implementation input box (Password box) prompts, javascript input box

Sometimes we need to have some prompt languages in the login form, such as "enter user name" and "Enter Password, however, it is a bit difficult to enter a password in the password box, because the entered content in the password box is not displayed with an explicit code. If the type attribute is dynamically controlled, there will be compatibility issues. If the input already exists in the page, the type attribute is read-only in IE8 and IE8 browsers. So you have to find another method. The Code is as follows:

<! DOCTYPE html> 

The above Code meets our requirements and prompts are displayed. When a password is entered, it is entered as a password.

The implementation principle is very simple. It is displayed in the type = "text" text box by default. When you click the text box, it is displayed in the type = "password" password box, the original text box is hidden, that is, a replacement is made.

Articles you may be interested in:
  • Javascript input box prompt list Effect
  • Js Code similar to the smart prompt in the Baidu input box
  • Code Implementation of the auto-Prompt function in the email box of the js input box
  • Js operation input box prompts and responds to mouse events
  • How to enter the number of words in the JavaScript dynamic prompt input box
  • Javascript-like Baidu input box prompts automatic drop-down completion

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.