2016-01-22 2 views
-1

Я работаю над моей первой заявкой PhoneGap и я столкнулся с проблемами при использовании JQuery мобильного с ним, я уже скачал JQuery мобильного и

я пытаюсь разделите страницу на 4 divs каждый с определенным цветом и напечатайте предупреждение, когда я нажму на любой из них. это мой код внутри index.html:

<!DOCTYPE html> 
<!-- 
    Copyright (c) 2012-2014 Adobe Systems Incorporated. All rights reserved. 

    Licensed to the Apache Software Foundation (ASF) under one 
    or more contributor license agreements. See the NOTICE file 
    distributed with this work for additional information 
    regarding copyright ownership. The ASF licenses this file 
    to you under the Apache License, Version 2.0 (the 
    "License"); you may not use this file except in compliance 
    with the License. You may obtain a copy of the License at 

    http://www.apache.org/licenses/LICENSE-2.0 

    Unless required by applicable law or agreed to in writing, 
    software distributed under the License is distributed on an 
    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 
    KIND, either express or implied. See the License for the 
    specific language governing permissions and limitations 
    under the License. 
--> 
<html> 
    <head> 
     <meta charset="utf-8" /> 
     <meta name="format-detection" content="telephone=no" /> 
     <meta name="msapplication-tap-highlight" content="no" /> 
     <!-- WARNING: for iOS 7, remove the width=device-width and height=device-height attributes. See https://issues.apache.org/jira/browse/CB-4323 --> 
     <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" /> 
     <link rel="stylesheet" type="text/css" href="css/index.css" /> 


     <title>Hello World</title> 
     <style> 
      .camArea 
      { 
       width: 50%; 
       float:left; 
       background: red; 
        height: 100%; 
      } 
      .camSection 
      { 
       width:100%; 
       height: 50%; 

      } 
      .camContainer 
      { 
       width: 100%; 
       height: 100%; 
       position:fixed; 
      } 
     </style> 


    </head> 
    <body> 
     <div class="app"> 
      <div class="camContainer"> 
      <div class="camSection"> 
       <div class="camArea" style = "background:blue" ></div> 
       <div class="camArea" style = "background:#ff4512"></div> 
      </div> 

      <div class="camSection"> 
       <div class="camArea" style = "background:green"></div> 
       <div class="camArea" style = "background:#34d3ff"></div> 
      </div> 
     </div> 
     </div> 
     <script type="text/javascript" src="cordova.js"></script> 
     <script type="text/javascript" src="js/index.js"></script> 
     <script type="text/javascript"> 
      app.initialize(); 

       $(".camArea").click(function(){ 
        alert("Toto") 
       }); 

     </script> 

    </body> 
</html> 

, когда я обед приложение или обновить страницу я получаю эту ошибку:

Uncaught ReferenceError: $ is not defined 

и это то, что мое приложение выглядит с ошибкой

enter image description here

и whwn я нажмите, чтобы увидеть ошибки я вижу эту

enter image description here

, когда я пытаюсь проверить, если существовал $, написав его на консоли я получаю это

function $(selector, [startNode]) { [Command Line API] } 

это изображение enter image description here

и когда я пытаюсь включать эта линия

<script type="text/javascript" src="jquery/jquery.mobile-1.4.5.min.js"></script> 

в <head></head>

я получаю эту ошибку: Uncaught TypeError: Cannot set property 'mobile' of undefined и вот изображение: enter image description here может любой помочь с этим, пожалуйста?

ответ

0

Ошибка:

$ is not defined 

стандартное сообщение для не включая jquery.js файл.

Это обычная форма jquery mobile refrences.

Так просто вставьте jquery.js в заголовок и перед jQuery mobile refrence file.

Смежные вопросы