我尝试在select2 4.0.1上设置一个bootstrap 3.5 popover,但它似乎不起作用:
<input id="sampleInput" type="text" rel="popover" data-content="This is the body of Popover" data-original-title="Creativity Tuts" data-placement="auto" data-trigger="hover" />
<p/>
<select id="selectb" data-content="This is the body of Popover" data-original-title="Creativity Tuts" data-placement="auto" data-trigger="hover" data-container="body">
<option>Please select ...</option>
<option value="1">Select2</option>
<option value="2">Chosen</option>
<option value="4">selectize.js</option>
<option value="6">typeahead.js</option>
</select>
js:
$(function () {
$('#sampleInput').popover();
$('#selectb').popover();
$('#selectb').select2();
});
可以在http://jsfiddle.net/s4w1z09v/
找到样本有任何评论吗?!
答案 0 :(得分:0)
作为一种解决方法;你可以尝试:
<input id="sampleInput" type="text" rel="popover" data-content="This is the body of Popover" data-original-title="Creativity Tuts" data-placement="auto" data-trigger="hover" />
<p/>
<span id="selectb-popover"
data-content="This is the body of Popover"
data-original-title="Creativity Tuts"
data-placement="auto"
data-trigger="hover"
data-container="body">
<select id="selectb">
<option>Please select ...</option>
<option value="1">Select2</option>
<option value="2">Chosen</option>
<option value="4">selectize.js</option>
<option value="6">typeahead.js</option>
</select>
</span>
并将您的js更新为:
$(function () {
$('#sampleInput').popover();
$('#selectb').select2();
$('#selectb-popover').popover();
});