HTML implements the function of detecting input completion

HTML implements the function of detecting input completion
  • Use "onInput(event)" to detect whether input is in progress
  • Use onporpertychange="onChange(event)" to detect whether the content has changed
  • Use onBlur="finnishInput(event)" to detect whether the focus is lost

You can first detect whether you are inputting and record the status. If you were inputting information last time and then lost focus, you can determine that the input is complete.

The HTML code is as follows:

<tr style="background-color:#FFFFFF">
    <th>Business trip location:</th>
    <td>
        <input class="form-control" onBlur="finnishInput(event)" "onInput(event)" onporpertychange="onChange(event)" id="travelLocationId" type="text" placeholder="travel location">
    </td>
</tr>

The JS code is as follows

var flag = 0;
function onInput(e){
  console.log("Inputing");
  flag = 1;
}

function finishInput(e) {
  if(1 == flag){
    console.log("InputOk");
    flag = 0;
  }
}

After testing, the function of judging whether the input is completed is realized and can be used repeatedly.

The above is the HTML implementation of the input completion detection function introduced by the editor. I hope it will be helpful to everyone. If you have any questions, please leave me a message and the editor will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website!
If you find this article helpful, please feel free to reprint it and please indicate the source. Thank you!

<<:  MySQL SQL Optimization Tutorial: IN and RANGE Queries

>>:  Docker configuration Alibaba Cloud Container Service operation

Recommend

Detailed explanation of CSS weight value (cascading) examples

•There are many selectors in CSS. What will happe...

Implementation of react routing guard (routing interception)

React is different from Vue. It implements route ...

TypeScript Mapping Type Details

Table of contents 1. Mapped Types 2. Mapping Modi...

Analysis of several reasons why Iframe should be used less

The following graph shows how time-consuming it is...

A brief analysis of the differences between px, rem, em, vh, and vw in CSS

Absolute length px px is the pixel value, which i...

Detailed explanation of client configuration for vue3+electron12+dll development

Table of contents Modify the repository source st...

Implementation of code optimization for Vue2.x project performance optimization

Table of contents 1 Use of v-if and v-show 2. Dif...

Win10 + Ubuntu 16.04 dual system perfect installation tutorial [detailed]

Be sure to remember to back up your data, it is p...

How to change the terminal to a beautiful command line prompt in Ubuntu 18

I reinstalled VMware and Ubuntu, but the command ...

Solution to the problem that VC6.0 cannot be used when installed on WIN10

VC6.0 is indeed too old VC6.0 is a development to...

WeChat Mini Program QR Code Generation Tool weapp-qrcode Detailed Explanation

WeChat Mini Program - QR Code Generator Download:...

Basic usage examples of Vue named slots

Preface Named slots are bound to elements using t...

A brief summary of all encapsulation methods in Vue

Table of contents 1. Encapsulation API 2. Registe...

Linux uses lsof command to check file opening status

Preface We all know that in Linux, "everythi...