laravelを初めて使用しています。これは私のスクリプトコードです。私はこのスクリプトを使用して、入力フィールドの場所を取得しています。Uncaught TypeError:Laravel 5.3を使用して未定義のプロパティ 'event'を読み取ることができません。
<script type="text/javascript">
google.maps.event.addDomListener(window, 'load', function() {
var places = new google.maps.places.Autocomplete(document.getElementById('job_location'));
google.maps.event.addListener(places, 'place_changed', function() {
var place = places.getPlace();
var address = place.formatted_address;
var latitude = place.geometry.location.A;
var longitude = place.geometry.location.F;
var mesg = "Address: " + address;
mesg += "\nLatitude: " + latitude;
mesg += "\nLongitude: " + longitude;
$('#latitude').val(latitude);
$('#longitude').val(longitude);
// alert(mesg);
});
});
私を導いてください私の中ではフェイルド名が "job_location" で置くしかしコンソールで、私はこの
(index):586 Uncaught TypeError: Cannot read property 'event' of undefined
のようなエラーが発生しています。
Googleマップライブラリを含めましたか? – motanelu
jqueryとjquery min jsの後にfooterでjquery ui jsを追加しました –
@motaneluどのようにライブラリを追加できますか – user7597883