JS clears the text box content and triggers the js method when the restore and mouse leaves the text box. The text box js

Source: Internet
Author: User

JS clears the text box content and triggers the js method when the restore and mouse leaves the text box. The text box js

The text box to be filled in for multiple websites provides a default prompt language by default. When you click this text box, you can clear the default text, when the input text is deleted and the focus leaves the text box, the default text is written into the text box.

The Code is as follows:

<! DOCTYPE html> 

The above Code meets our requirements. When you click the text box, you can clear the content in the text box. If no content is entered in the text box, when the mouse focus leaves the text box, the value of the text box is restored to the default state. However, if the password box is not displayed in plain text, you can refer to the prompt section in the JavaScript implementation input box (Password box.

How to trigger js when the mouse leaves the text box

<% @ Page Language = "C #" AutoEventWireup = "true" CodeBehind = "WebForm1.aspx. cs" Inherits = "textBox. WebForm1" %> <! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
Articles you may be interested in:

  
  • Clear the js Code of the text box content when refreshing
  • Js Code that captures the content of the input text box and changes the event
  • The textarea height of the Javascript text box scales in and out as the content increases automatically.
  • Use js to dynamically add text boxes to the foreground, and obtain text box content in the background (sample code)
  • A simple example of JS determining the event of text box content change
  • Js: How to synchronously obtain the content of a text box from the div layer on the input text page in the text box
  • Javascript auto-Restore text box click to clear the default text

Related Article

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: info-contact@alibabacloud.com 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.