2016-10-06 5 views
0

작동하지 않습니다JQuery와 대화 상자가 내 헤더에 포함했다

ReferenceError: jQuery is not defined 
    factory(jQuery); 

<body> 
     <script> 
      $.extend({ alert: function (message, title) { 
         $("<div></div>").dialog({ 
         buttons: { "Ok": function() { $(this).dialog("close"); } }, 
         close: function (event, ui) { $(this).remove(); }, 
         resizable: false, 
         title: title, 
         modal: true 
         }).text(message); 
        } 
       }); 

      $.alert('message', 'fileName'); 
     </script> 
    </body> 

내 코드에서 대화 상자가 작동하지 않는 이유가 확실하지 않습니다. 내 대본에 뭔가 빠져 있거나 다른 것이 문제일까요?

<head> 
    <script type="text/javascript" src="jquery/jquery-3.1.1.js"></script> 
    <script type="text/javascript" src="jquery/jquery-ui.js"></script> 
    <link rel="stylesheet" type="text/css" href="jquery/jquery-ui.css"> 
    <link rel="stylesheet" type="text/css" href="jquery/jquery-ui.structure.css"> 
    <link rel="stylesheet" type="text/css" href="jquery/jquery-ui.theme.css"></script> 
</head> 

의 버전을 사용할 수 있습니다 (jQuery를 UI는 jQuery를 사용하기 때문에 jQuery를 먼저로드해야하기 때문에) JQuery와 스크립트 후 jQuery를 UI 스크립트를 포함

답변

1

시도, 당신은이처럼 모두 필요 당신이 가지고있는 스크립트 인 "jquery-3.1.1.js"는 그 예입니다.

jQuery 스크립트를 두 개 필요로하지 않는다는 말을 들었습니다. 일반 스크립트와 축소 스크립트를 모두 제거하지 말라는 것입니다. 이렇게까지 일을 요약하면

  1. jQuery를 = jQuery를 분 JQuery와! = jQuery를-UI
  2. jQuery를-UI는 jQuery를 필요로
  3. 처음로드 할.
+0

UI 스크립트와 버전을 다운로드 할 수 있습니까? –

+0

http://jqueryui.com/download/ 여기에서 최신 버전 –

+0

을 사용해보십시오. 한 가지 더요, jQuery 스크립트의 정규 버전과 축소 버전을 모두 포함해야하는 이유는 무엇입니까? 제거하십시오. –

관련 문제