[Timlinux] Introduction to the Onfocus/onblur/oninput/onchange event of the JavaScript input box

Source: Internet
Author: User
1. onfocus Events

When the input box gets to the focus, it triggers the event, such as modifying the background color of the input box when it gets to the focus. This feature can actually be defined using CSS's pseudo-class: focus.

2. onblur Events

This with the onfocus event idea, when the input box loses focus, triggers the event, such as changing the input text uniformly to lowercase

3. OnChange Events

The occurrence of this event requires 2 conditions:

  • Lose focus
  • The content has changed
4. Oninput Events

This time HTML5 the newly added event, IE9 was not supported before the IE9 was used: Onpropertychange event, this event, used to do real-time search function is very suitable. When the content of the input box changes, a real-time trigger event, such as entering a character, or deleting a character, will trigger the occurrence of the event.

5. Example

The event is relatively simple, do not give an example, you can go online for each event, a separate search example!

[Timlinux] Introduction to the Onfocus/onblur/oninput/onchange event of the JavaScript input box

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.