0
我正在使用引導工具提示向SVG路徑添加一些信息。我添加了一個錨點鏈接到工具提示的標題,這是確定的,直到我點擊錨點做一些事情。它不像一個主播,並且不會引發任何事件。自舉工具提示標題中的錨鏈接不會像點擊錨一樣起作用
這是代碼:
<g id="B2" class="blockgroup">
<path id="B2_Block" class="block" d="M195.4,128.9c-28,18.2-51.9,42.2-70.1,70.2l33.3,19.3c14.8-22.6,34-42,56.5-57L195.4,128.9z"/>
<text id="B2_Text" transform="matrix(1 0 0 1 166.0186 177.8625)" class="text">B2</text>
</g>
$('.blockgroup').tooltip({
html: true,
animation: true,
container:'body',
trigger: 'click',
title: function(){
return '<div class="tooltip-box">' +
'<span>Block</span>' +
'<h3>' + this.id + '</h3>' +
'<a href="#" class="view-seats" data-block-id="' + this.id + '">View Seats</a>' +
'</div>';
}
});
$('.view-seats').on('click', function(e){
e.preventDefault();
console.log('clicked');
});
的可能的複製(http://stackoverflow.com/questions/203198/event-binding-on-dynamically-created-elements) –