3
我正在使用select2。內置事件不支持選擇項目上的懸停事件,因此我試圖在鼠標懸停在項目上(多重選擇)時觸發懸停事件。然而如何在select2選項上啓用懸停事件
function tagFormat(state) {
return '<span class="tagElement">' + state.text + '</span>';
}
$('.tagElement').hover(function(event){
alert('something');
});
var sampleTags = ['red','white'];
$("[taggable]").select2({
formatSelection: tagFormat,
maximumInputLength: 10,
tags:sampleTags,
tokenSeparators: [",", " "]
});
在
http://bootply.com/96527
Bootply,你可以看到外面的選擇2懸停事件做內選擇2火事實並非如此。裏面的機制是什麼?