我有一個默認class.popover和ID爲#tags的輸入的引導彈窗。在popover裏面我有一個鏈接列表。我想點擊一個鏈接,並從Bootstrap彈出窗口填充輸入
這是我的代碼,並填寫的內容輸入什麼,我已經試過:
<div class="popover fade bottom in" role="tooltip" id="popover551732" style="top: 34px; left: 2px; display: block;">
<div class="arrow"></div>
<h3 class="popover-title">5 most recent</h3>
<div class="popover-content">
<ul class="popover-content">
<li><a href="javascript:;" class="first">First matter</a>
</li>
<li><a href="#">Second matter</a>
</li>
<li><a href="#">Third matter</a>
</li>
<li><a href="#">Fourth matter</a>
</li>
<li><a href="#">Fifth matter</a>
</li>
</ul>
</div>
</div>
<input type="text" id="tags" ....
我試了一下:
$(function(){
$('.first').live('click', function() {
$("#tags").val($(this).html());
});
});
請不要使用「bootstrap」標籤,使用「twitter-bootstrap」,因爲它意味着別的東西 – 2014-10-12 12:54:45