Link to home
Start Free TrialLog in
Avatar of willsherwood
willsherwood

asked on

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

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>
ASKER CERTIFIED SOLUTION
Avatar of Russ Suter
Russ Suter

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of willsherwood
willsherwood

ASKER

thank you