In-depth understanding of HTML form input monitoring

In-depth understanding of HTML form input monitoring

Today I saw a blog post about input events, and on a whim I sorted out the relevant information.

event:

 function changeVal(value){ console.log($(value).val())}

onchange: The onchange event is triggered only when the previous and next content changes and loses focus.

 <input type="text" value="" onchange="changeVal(this)">

oninput: The oninput event is triggered when the value changes.

 <input type="text" value="" oninput="changeVal(this)">

There is also an onpropertychange event, which has a similar effect to oninput, but is specific to IE! And it didn’t work when I tested it, I was totally confused. . .

Replenish:

Cases where oninput and onpropertychange fail:

oninput event:

(1) When the value is changed in the script, it will not be triggered;

(2) It will not be triggered when selecting from the browser's automatic drop-down prompt;

onpropertychange event:

When input is set to disable=true, it will not be triggered.

The above is all the content of the in-depth understanding of html form input monitoring brought to you by the editor. I hope you like it~

If you want to know more about game activities and game strategies, please continue to pay attention to this site. The editor of this site will bring you the best, most fun and freshest game information as soon as possible. For more exciting content, please visit jb51 game channel!

<<:  Detailed explanation of the difference between url ending with / and without / in nginx proxy_pass configuration

>>:  What is a MySQL tablespace?

Recommend

Detailed explanation of how MySQL solves phantom reads

1. What is phantom reading? In a transaction, aft...

Vue uses v-model to encapsulate the entire process of el-pagination components

Use v-model to bind the paging information object...

Sequence implementation method based on MySQL

The team replaced the new frame. All new business...

Ubuntu16.04 installation mysql5.7.22 graphic tutorial

VMware12.0+Ubuntu16.04+MySQL5.7.22 installation t...

How to use IDEA to configure tomcat and create JSP files

Before using idea to write JSP files, you need to...

Detailed tutorial on installing phpMyAdmin on Ubuntu 18.04

We will install phpMyAdmin to work with Apache on...

Tutorial on installing mysql5.7.18 on windows10

This tutorial shares the installation and configu...

Introduction to CSS style classification (basic knowledge)

Classification of CSS styles 1. Internal style --...

jQuery realizes the effect of theater seat selection and reservation

jQuery realizes the effect of theater seat select...

Detailed explanation of Angular routing basics

Table of contents 1. Routing related objects 2. L...

Import csv file into mysql using navicat

This article shares the specific code for importi...

Front-end JavaScript Promise

Table of contents 1. What is Promise 2. Basic usa...