Function doesn't work with latest API

Function doesn't work with latest API

I have the following character counting code. It works fine if the line to load the API is  jquery/1.4/jquery.min.js. If I change it to  jquery/1.10.2/jquery.min.js, the div doesn't update. Would someone point out the problem, please?

  1. <div><input type="text" name="title" value="Replace me" id="pagetitle"                             
  2.    onkeyup="javascript:return ShowCharacterCount('pagetitle')">
  3. </div> 
  4. <div><input type="text" disabled name="title_cnt" id="pagetitle_cnt" value="0"></div>


  5. <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>

  6. function ShowCharacterCount(id) {
  7.   var cnt = ($("#" + id).attr("value")).length; //how many characters in box
  8.   var dest = id + "_cnt";
  9.   $( "#" + dest ).val( cnt );   //display the new count
  10. }