But on such a little thing

<script src="https://code.jquery.com/jquery-1.8.0.min.js"></script> <form> Enter word: <input type="text" name="word" id="ajax_word"> </form> <script> $('#ajax_word').input(function(ev) { console.log(this.val()); }); </script> 

swears like this: Uncaught TypeError: $ (...). input is not a function

obviously somewhere something wrong wrote. In Google, this question is differently suited, mostly they write that the path to the library must be correct, but why download it if you can insert a link?)

    1 answer 1

    It is necessary to use not .input , but .on("input", And instead of this , jquery uses the construction $(this) .

     <script src="https://code.jquery.com/jquery-1.8.0.min.js"></script> <form> Enter word: <input type="text" name="word" id="ajax_word"> </form> <div></div> <script> $(function(){ $('#ajax_word').on('input',function(ev) { $('div').text($(this).val()); }); }); </script> 

    https://codepen.io/baryonyx/pen/aYpNxw