HTML DOM DefaultValue Properties

Source: Internet
Author: User

Definition and usage

The DefaultValue property sets or returns the initial contents of the text box.

Note: The initial value of the text box is the text that is located between the <textarea> and the </textarea> labels. When the form is reset, the text box is restored to the entire value. Changing the value of this property changes the text currently displayed in the text box.

Syntax: Textareaobject.defaultvalue=text

Example 1:

The following example indicates the default value for the text box:

<input id= "Input" value= "SNTETWT"/><script>    $ (function () {        alert (document.getElementById (' Input '). DefaultValue);       Result: SNTETWT        alert (document.getElementById (' input '). value);    }); </script>

HTML DOM DefaultValue Properties

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.