The content of the input input box is obtained in real time
Apr 19, 2018 am 09:46 AMThis time I will bring you the real-time acquisition of the input input box content. What are the precautions for the real-time acquisition of the input input box content. The following is a practical case, let's take a look.
Real-time monitoring of the content of the input box! The event will be triggered only if the content of the input box changes. If the content of the input box does not change, the event will not be triggered!
The code is as follows:
<script type="text/javascript" src="jquery-3.2.1.js"></script> <script type="text/javascript"> function OnInput (event) { alert (event.target.value); } function OnPropChanged (event) { if (event.propertyName.toLowerCase () == "value") { alert (event.srcElement.value); } } </script> <form> 用户名:<input name="user" type="text" oninput="OnInput (event)" onpropertychange="OnPropChanged (event)"/> </form>
I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the PHP Chinese website!
Recommended reading:
JS implements evaluation star rating
##JS implements data validation and check box form submission
The above is the detailed content of The content of the input input box is obtained in real time. For more information, please follow other related articles on the PHP Chinese website!

Hot Article

Hot tools Tags

Hot Article

Hot Article Tags

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

The combination of Java and WebSocket: how to achieve real-time video streaming

Using C++ to implement real-time audio and video processing functions of embedded systems

How to get the last element of LinkedHashSet in Java?

Java program to get the size of a given file in bytes, kilobytes and megabytes

JavaScript and WebSocket: Building an efficient real-time weather forecasting system

How to use Java Websocket to implement real-time weather forecast function?
