Jquery .change()函数在localhost上不起作用

sdi*_*iri 3 jquery controls input textchanged

以下代码适用于jsfiddle但不适用于localhost,你能帮帮我吗?

<script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>
    <script>
        $('.puankontrol').change(function() {
          var x = $(this).val() * 1;   
          if((x < 1) ||  (x > 5))
          {
              $(this).val(3);
              alert("Please enter value between 1-5!");
          }
        });
    </script>
</head>
<body>

     <form>
      <input class="puankontrol" type="text" name="puan"/><BR>
      <input class="puankontrol" type="text" name="puan"/><BR>
      <input class="puankontrol" type="text" name="puan"/><BR>
    </form>
    <div id="other">
      Trigger the handler
    </div>

</body>
</html>
Run Code Online (Sandbox Code Playgroud)

`

Dip*_*mar 7

尝试

$(document).ready(function(){
   //change function declaration.
});
Run Code Online (Sandbox Code Playgroud)

<script type="text/javascript">用于添加script标签.