1

I'm trying to use jquery ui:s autocomplete widget in an appframework phonegap app. I'm using the jq.appframework.js plugin as per the documentation, like so:

<script src="appframework/jquery.js"></script>
<script src="appframework/jq.appframework.js"></script>
<script src="appframework/appframework.ui.js"></script>
<link rel="stylesheet" href="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/themes/smoothness/jquery-ui.css" />
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/jquery-ui.min.js"></script>

But when the page loads the app breaks and I get the following console error:

uncaught TypeError: Cannot read property '__events' of undefined.

Its the following row (the second one, nr 261) that throws the error in jq.appframework.js:

   $.bind = function (obj, ev, f) {
   if (!obj.__events) obj.__events = {};

Not sure how to proceed with this, all help much appreciated!

4

1 回答 1

1

这是appframeworkwithjquery和的工作示例jqueryui

您也可以只使用af.ui.jquery.min.jswith jquery.js, (而不是jq.appframework.jsand appframework.ui.js

<!DOCTYPE html>
<html>
  <head>
    <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0;" />  
    <link rel="stylesheet" href="af.ui.css" />
    <link rel="stylesheet" href="icons.css" />
    <script src="js/jquery-1.11.1.min.js"></script>
    <script src="js/af.ui.jquery.min.js"></script>
    <link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/themes/smoothness/jquery-ui.css" />
    <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/jquery-ui.min.js"></script>
    <script>
  $(function() {
    $( "#datepicker" ).datepicker();
  });
  </script>  
  </head>
  <body>
    <div id="afui">
        <div id="content">
            <div id="main" class="panel" title="Home" selected="true">
                <p>Hello</p>
                <p>Date: <input type="text" id="datepicker"></p>
            </div>    
        </div>    
    </div>      
  </body>
</html>
于 2014-05-14T18:08:17.857 回答