Javascript question:   TypeError:  $(...).on is not a function

willsherwood
willsherwood used Ask the Experts™
on
I'm using the following script.  Can anyone help debug?     Thank you!

<head>

 
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>

<script type="text/javascript">

$(document).ready(function() {  // script wrapper

      $('textarea, input').on('blur', function() {
            var itemID = $(this).attr('id');
            var itemVal = $(this).val();
            var itemVal = itemVal.replace(/\n/g, '<br />');
            var itemVal = itemVal.replace(/&/g, 'and');
            var itemstring = "ID=" + itemID + "&value=" + itemVal;
      
            processChange(itemstring);
      });

      function processChange(itemstring){
            //console.log(itemstring);
            //return false;
            $.ajax({
                  type: "GET",
                  url: "php/update.php",
                  data: itemstring,
                  complete: function(data) {
                        var Resp = data.responseText;
                        //console.log(Resp);
                  },
                  success: function() {
                        $('#saved').css('display', 'block');
                        setTimeout(function() {
                              $('#saved').animate({
                                    opacity: 0,
                              }, 500, function(){
                                    $('#saved').css('display', 'none').css('opacity', '1');
                              });
                        }, 1000);
                  }
            });
      }// end ProcessChange

}); // end script wrapper
 
</script>

</head>
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Senior Software Developer
Commented:
Your jQuery reference is for a very old version. Update your reference.

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>

Author

Commented:
thank you

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial