Loading...
Copy code
Close
Permalink
Close
Please tell us why you want to mark the subject as inappropriate.
(Maximum 200 characters)
Report Inappropriate
Cancel
Private Message
From :
guest
To :
Subject :
Content :
Type the characters you see in the picture below.
Send
Cancel
From :
guest
To :
Subject :
Content :
Type the characters you see in the picture below.
Send
Update
Cancel
Feedback
Email ID
Subject :
Comments :
Send
Cancel
Private Message
Type the characters you see in the picture below.
Type the characters you see in the picture below.
Attach files
Desktop
Zoho Docs
Google Docs
Each Attachment size should not exceed 1MB.
Max no of attachments : 3
Loading User Profile...
guest
Response title
This is preview!
Attachments
Publish
Back to edit
Cancel
(
)
Sign In
New to this Portal? Click here to
Sign up
You can also use the below options to login
Login with Facebook
Login with Google
Login with Yahoo
jQuery
Plugins
UI
Meetups
Forum
Blog
About
Donate
All Forums
Recent Posts
Log In
Search
jQuery
Search
jQuery Forum
Screen name:
abbnet
abbnet's Profile
1
Posts
0
Responses
0
Followers
Activity Trend
Last 30 days
Last 30 days
Date Interval
From Date :
To Date :
Go
Loading Chart...
Posts
Responses
PM
Show:
All
Discussions
Questions
Ideas
Problems
Expanded view
List view
Private Message
jquery mobile and google maps places api v3 autocomplete
[2Replies]
07-Feb-2012 06:58 PM
Forum:
jQuery Mobile
Dear,
I was not able to find my solution (only found other solutions that I 'can not' use).
My context :
I have an input text field in JQM. The user should fill an address (number street town) like in Google Maps.
I want an autocomplete with suggested address.
My constraint :
Use the
V3
Google Maps Api "places" that offer an "autocomplete" function (
http://code.google.com/intl/fr-FR/apis/maps/documentation/javascript/places.html#places_autocomplete)
:
function myAutocomplete() {
var input = document.getElementById('searchAddress');
var autocomplete = new google.maps.places.Autocomplete(input, options);
}
Or/and use JQM autocomplete feature for a input text field :
$('#address').live('pagecreate', function (event) {
$('#searchAddress').autocomplete({
source: ....
minLength: 3,
select: function(event, ui) {
$('#searchAddress').val(ui.item.label);
return false;
}
});
});
On a web browser of a computer (not a mobile phone), the Google autocomplete workd fine, but on a mobile phone, the autocomplete does not really work.
I found solution that use the "source" argument that point to
- another page (that return a JSON result from Google API Places)
- or point to another js function that make a Jquery request in ajax (that get the JSON result)
But I do not want to use theses solutions because it use Google API in https and the API key.
I want to use the Google API V3.
I did not succeed to use the object :
- new google.maps.places.Autocomplete(input, options);
- with JQM input text field and autocomplete
Extract of source code (without javascript for autocomplete as I do not have a correct solution) :
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="http://code.jquery.com/ui/1.8.17/themes/base/jquery-ui.css" />
<link rel="stylesheet" type="text/css" href="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.css" />
<script src="//maps.googleapis.com/maps/api/js?sensor=false&libraries=places&language=fr" type="text/javascript"></script>
<script src="http://code.jquery.com/jquery-1.6.4.min.js" type="text/javascript"></script>
<script src="http://code.jquery.com/ui/1.8.17/jquery-ui.min.js" type="text/javascript"></script>
<script src="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.js" type="text/javascript"></script>
<title>Application mobile - Démo</title>
</head>
<body>
<div data-role="page" id="address">
<div data-role="header" data-position="inline">
<a data-rel="back" data-icon="arrow-l">Retour</a>
<h1>Démonstration</h1>
</div><!-- /header -->
<div data-role="content">
<p>Adresse</p>
<label for="searchAddress" class="ui-hidden-accessible">Saisir une adresse :</label>
<input type="search" name="address" id="searchAddress" value="" placeholder="Saisir une adresse..."/>
<p><a data-rel="back" data-role="button" data-icon="check">Valider</a></p>
</div><!-- /content -->
</body>
</html>
Thank you for any help.
«Prev
Next »
Moderate user : abbnet
Forum