2013-10-08 81 views
1

我知道這個問題是描述和回答無處不在,雖然我找不到我的問題是什麼。這是我的代碼:

<!doctype html> 
<html> 
    <head> 
     <title>jQM Complex Demo</title> 
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
     <link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.css" /> 
     <script src="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.js"></script> 
     <script src="script.js" type="text/javascript"></script> 
     <!--<meta http-equiv="Content-Type" content="txt/html; charset=utf-8" /> 

     <script src="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.js"></script>  
     <script src="mobileJquery.js"></script>--> 
    </head> 
    <body> 
     <div> 
      <h1><a href="http://www.stronteb.eu">test application</a></h1> 
      <p id="testparagraaf">test</p> 
      <img src="stront.gif"/> 
     </div> 

     <!--<script src="script.js" type="text/javascript"></script>--> 
    </body> 
</html> 

和的script.js:

$(document).on('pageload', 'index.html', function(e){  
    alert('Pageload'); 
}); 

我知道的jQuery需要的script.js之前加載,這是這裏的情況。我試着把代碼放入html中,沒用...

任何人都知道問題出在哪裏?

親切的問候

+1

[jQuery Mobile入門錯誤]的可能重複(http://stackoverflow.com/questions/19238849/jquery-mobile-getting-started-error) – Omar

+0

此外,您的警報不會觸發。 '$(document).on('pageinit',function(){alert('pageinit');});'檢查:http://view.jquerymobile.com/1.3.2/dist/demos/widgets/網頁 – Omar

回答

9

你沒有加載jQuery本身。在加載jQuery Mobile之前,您需要加載jQuery。 jQuery Mobile不是jQuery,不包含jQuery。

jQuery Mobile就像jQuery UI:它本質上是一個jQuery插件,在加載插件之前必須加載jQuery。

相關問題