How in jquery to track the change of value="" in input text in real time? That is, as soon as the value="" changed, the alert($(this).val());

    2 answers 2

    I personally use:

      $(document).ready(function(){ $('selector').on('input', function(){ aletr(' я не искал ответ в гугле :D ') }) }); 

    But there are several ways, keyup , input , change events. Choose what suits you best.

    In Google this is called: jQuery event or JavaScript event (events).

      For example:

       $('input').on('keyup',function(){ var $this = $(this), val = $this.val(); if(val.length >= 1){ alert('изменился символ'); } }); 
       <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <input type="text" name="n" id="n">