Onpropertychange is used in Javascript development. The oninput event solves the problem of onchange events.

Source: Internet
Author: User

When onchange is used in the text box input box, there is an obvious deficiency. The event will not be triggered with the text input, but will be triggered when the text box loses the focus (onblur). That is, there is no instant!

In IE, onpropertychange can be used to replace the onchange event. This event can be triggered immediately when there is any change in the text box.

In this way, the problem is solved.

What about other browsers? onpropertychange is the patent of IE. The next step is the oninput event.

However, oninput has a strange problem. You must use addeventlistener to bind the event. Otherwise, the event is invalid.

Okay. The following is a demo. it's okay for mainstream browsers:

Xmlns = "http://www.w3.org/1999/xhtml">


Onchange event:

Use the onpropertychange/oninput event:

Result:

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.