0
我試圖從Bing地圖上放置的窗口標記中的鏈接觸發事件 但是當我點擊鏈接時,我被重定向到一個新頁面而不是JS一個函數綁定到事件jquery-bing-maps點擊事件沒有從窗口標記觸發
$('.single_address').live('click', function (evt) {
alert('test');
return false;
});
for (var i = 0; i < locations.length; i++) {
(function (i) {
var location_id = locations[i].aid;
var address_street = locations[i].d;
// var self = this;
self.addMarker({
'location': locations[i].la + ',' + locations[i].lo,
'bounds': true
}).click(function() {self.openInfoWindow({
'title': address_street,
'description': '<div class="single_address"><a href="test.php#list1">Contacts at this address</a></div>'
}, this);
});
})(i);
}
所以基本上是沒有得到顯示警告信息,但網頁會被重定向到test.php的
使用jQuery-1.8.2和jQuery Mobile的1.2
? 'live()'已在1.9中刪除http://api.jquery.com/live/ – wakooka 2013-02-22 11:56:33
您能否向我們提供HTML代碼,以便我們看到您的元素的定義。如果HMTL鏈接中有'single_address',那麼href應該設置爲:'javascript:void();'。 – 2013-02-24 17:17:46
謝謝你的回答@NicolasBoonaert我希望我能幫你解決問題。該鏈接由'description'選項中的Javascript生成,可能由於滾動條而不明顯。我希望能回答你的問題 – Martin 2013-02-25 10:47:08