2015-01-26 2 views
0

이 자바 스크립트 코드는 내 Python Flask 코드에서 작동하지 않습니다. 무엇이 문제인지, 라이브러리를 올바르게 사용 중입니다.이 자바 스크립트 코드는 Python Flask와 작동하지 않습니다.

$(document).ready(function(){ 
    $("#name").focusin(function(){ 
     if(/^[a-z ,.'-]+$/.test($(this).val())){ 
      $(this).css("border-color", "#37ff00"); 
     }else{ 
      $(this).css("border-color", "red"); 
     } 
    }); 
    $("#er").keyup(function(){ 
     if(/^[0-9]+$/.test($(this).val())){ 
      $(this).css("border-color", "green"); 
     }else{ 
      $(this).css("border-color", "red"); 
     } 
    }); 
}) 

렌더링 템플릿 파이썬의 플라스크 코드를 렌더링 후에 와서 내가 생각하는 올바른하지만 스크립트가

<!DOCTYPE HTML> 
<html> 
    <head> 
     <link rel= "stylesheet" href= "style.css"> 
     <script src="script.js" ></script> 
     <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>   
    </head> 
    <body> 
     <form id="CSI" > 

      <label for="er">Enrollment No:</label> 
      <input id="er" name="er" type="text"> 

      <label for="name">Name:</label> 
      <input id="name" name="name" type="text"> 

     </form> 
    </body> 
<html> 

를 사용 CSS 그것은 그것에게 양식을 사용 작동하지 않는 내가 원하는 변경해야 함

#CSI input 
{ 
    padding:5px; 
    margin:5px; 
    width:200px; 
    height:20px; 
} 
#CSI input:focus 
{ 
    outline:none; 
    border-color:blue; 

} 
+5

'작동하지 않습니다'라는 것이 정확히 무엇입니까? 무슨 일이야? 무슨 일이야? 콘솔에서 오류를 확인 했습니까? ...'script.js'가 스크립트라면, ** import ** 후에 jQuery를 가져와야합니다. – Pointy

+0

css doesnt changes ' –

+1

'

관련 문제