2013-10-09 7 views
1

Express 웹 애플리케이션 용 Jade 파일에 JQuery가 있지만 아무 것도 호출되지 않습니다.JQuery가 Jade와 함께 작동하지 않습니다.

!!!5 
html 
    head 
     title #{title} 
     link(rel='stylesheet', href='/stylesheets/style.css') 
     script(type='text/javascript', src="http://code.jquery.com/jquery-1.9.1.min.js") 
     script(type='text/javascript', src="/idle-timer.js") 
     script(type='text/javascript'). 
      $(document).ready(function() { 
       $(document).idleTimer(10000); 
       $(document).on("idle.idleTimer", function(){ 
        console.log("alert"); 
       }); 

       $(#info).click(function(){ 
        $(this).hide(); 
       }); 
      }); 
    body 
     header 
      h1 Web App Sample 
     .container 
      .main-content 
       block content 
      .sidebar 
       block sidebar 
     footer 
      block foot 

사람이 문제가있을 수 있습니다 무엇을 볼 수 있습니다

extends layout 
block content 
    p Landing page 
    #info Info area 
block foot 
    a(href="https://localhost:8888/logout", title="logout") Logout 

여기 레이아웃 옥 파일의 다음은 콘텐츠 옥 파일입니까? 어쩌면 들여 쓰기?

+1

'스크립트 (유형 = '텍스트/자바 스크립트')'- 줄 끝에이 점을합니까 아무것도? JS를 외부 파일에 추가하고'idle-timer.js '처럼 JS를 호출하는 것이 더 쉬울 수도있다. – Andy

+0

도트를 추가하지 않으면 콘솔에 경고 메시지가 표시되므로 반드시 "script"와'style'에 대한 암시 적 text 전용을 사용하지 말고 대신'script.' 또는'style.'을 사용하십시오. " – gjw80

+2

올바른 HTML을 얻는다면 소스에서 생성 된 코드를 확인해보십시오. 또한, 당신은'$ ('# info')에 qoutations를 추가하지 않았습니다. – Drew

답변

1

내 모바일에서 볼 하드,하지만 당신은 같은 스크립트 코드를 들여 않았다.

html 
    head 
     script(src='jsfile') 
     script 
      $(document).ready 
    body #same level as head! 
     header 
관련 문제