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

JavaScript closure details

Table of contents 1. What is a closure? 2. The ro...

Vue realizes the sliding cross effect of the ball

This article example shares the specific code of ...

Using group by in MySQL always results in error 1055 (recommended)

Because using group by in MySQL always results in...

How to use resident nodes for layer management in CocosCreator

CocosCreator version: 2.3.4 Most games have layer...

How to modify the IP restriction conditions of MySQL account

Preface Recently, I encountered a requirement at ...

Web Design Principles of Hyperlinks

<br />Related articles: 9 practical tips for...

Vue uses Canvas to generate random sized and non-overlapping circles

Table of contents Canvas related documents Effect...

Hide div in HTML Hide table TABLE or DIV content css style

I solved a problem tonight that has been botherin...

A detailed introduction to JavaScript primitive values ​​and wrapper objects

Table of contents Preface text Primitive types Pr...

Command to remove (delete) symbolic link in Linux

You may sometimes need to create or delete symbol...

WeChat applet realizes the nine-square grid effect

This article shares the specific code for the WeC...

A brief analysis of the difference between FIND_IN_SET() and IN in MySQL

I used the Mysql FIND_IN_SET function in a projec...

How to configure common software on Linux

When you get a new Linux server, you generally ha...

A small problem about null values ​​in MySQL

Today, when testing the null value, I found a sma...

MySQL json format data query operation

The default table name is base_data and the json ...