ウェブサイトで Google マップを使用しています。
Web サイトでマップを表示するときに、クリックできるさまざまなピン (場所) があります。
場所をクリックすると、ポップアップ ボックス (Google マップの吹き出し) が表示されます。ここで、 Addressフィールドの横に追加のコンテンツを追加したいと考えています。これを行う唯一の方法は、jQuery を使用することです。
ポップアップ バブルの html は次のとおりです。
<div class="google-map-placeholder">
<div class="bubble-content">
<h4>Address: </h4>
<p class="custom-bubble-text">Lat and long...</p>
<p class="custom-bubble-text">PE Offices</p>
</div>
</div>
カスタム テキスト custom を Address: 要素に追加する方法
jQuery:
var x = $('div.google-map-placeholder').find('div.bubble-content p.custom-bubble-text').html();
if(x == 'NY Offices'){
$('div.google-map-placeholder').find('div.bubble-content h4').html('Address: My custom address');
}
しかし、それは機能しません(私のhtmlを追加しません)...
マップ マーカー アイコンをクリックするときにイベント リスナーを追加する必要があると思いますが、どうすればよいですか?