Introduction to python web py (62) - jQuery - determine whether the input content of the text box has changed

In the previous study of text box input, the event response of button press and pop-up, now let's learn the events that are triggered when the content of the text box changes.
Definition and usage The change event occurs
when the value of an element changes (applies only to form fields).


The change() method triggers the change event, or specifies a function to run when the change event occurs.
Note: When used on select elements, the change event occurs when an option is selected. When used in a text field or text area, the change event occurs when the element loses focus.


You can use the following example to test:
<html>
  <head>
    <meta charset="utf-8">
    <script type="text/JavaScript" src="jquery/jquery-3.3.1.js"></script>
  </head>
  <script>
    $(document).ready(function(){
      $("input").change(function(){
        alert("The text of the text box has changed.");
      });
    });
  </script>
  <body>
    Please enter: <input type="text">
  </body>
</html>

Result of running:


You can also manually modify the C compiler

card game development

http://edu.csdn.net/course/detail/5538 

Backgammon game development

http://edu.csdn.net/course/detail/5487
RPG games from entry to mastery


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325599291&siteId=291194637