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

Summary of common tool functions necessary for front-end development

1. Time formatting and other methods It is recomm...

The most basic code for web pages

◆Add to favorites illustrate Click to add your we...

Use SQL statement to determine whether the record already exists before insert

Table of contents Determine whether a record alre...

vue3 custom directive details

Table of contents 1. Registering custom instructi...

Example of how to configure the MySQL database timeout setting

Table of contents Preface 1. JDBC timeout setting...

Exploring the practical value of the CSS property *-gradient

Let me first introduce an interesting property - ...

Vue+Openlayer uses modify to modify the complete code of the element

Vue+Openlayer uses modify to modify elements. The...

MySQL 8.0.18 installation and configuration graphic tutorial

Learning objectives: Learn to use Windows system ...

Sample code for automatic web page refresh and automatic jump

Automatic web page refresh: Add the following code...

React implements double slider cross sliding

This article shares the specific code for React t...

The meaning and calculation method of QPS and TPS of MySQL database

When doing DB benchmark testing, qps and tps are ...

JavaScript operation elements teach you how to change the page content style

Table of contents 1. Operation elements 1.1. Chan...