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

Introduction to general_log log knowledge points in MySQL

The following operation demonstrations are all ba...

What you need to know about MySQL auto-increment ID

Introduction: When using MySQL to create a table,...

Summary of various methods of implementing article dividing line styles with CSS

This article summarizes various ways to implement...

How to create a database in navicat 8 for mysql

When developing a website, you often need to use ...

Ubuntu MySQL version upgraded to 5.7

A few days ago, the library said that the server ...

A detailed introduction to seata docker high availability deployment

Version 1.4.2 Official Documentation dockerhub st...

Solution to Nginx SSL certificate configuration error

1. Introduction When a web project is published o...

Linux redis-Sentinel configuration details

download Download address: https://redis.io/downl...

Example analysis of mysql variable usage [system variables, user variables]

This article uses examples to illustrate the usag...

Implementation of Docker private library

Installing and deploying a private Docker Registr...

What is Software 404 and 404 Error and what is the difference between them

First of all, what is 404 and soft 404? 404: Simpl...

CSS writing format, detailed explanation of the basic structure of a mobile page

1. CSS writing format 1. Inline styles You can wr...

Uniapp WeChat applet: Solution to key failure

uniapp code <template> <view> <ima...