1 回答

TA貢獻(xiàn)1796條經(jīng)驗(yàn) 獲得超4個(gè)贊
問題出現(xiàn)是由于鏈接上的點(diǎn)擊功能。通過指定包含這些鏈接的 div 的 ID 來定義兩個(gè)單獨(dú)的鏈接組。
// Set searched text in input field on click of search button
$(document).on("click", "#from-show-list a", function() {
$("#from-input").val($(this).text());
$("#from-show-list").html("");
});
// Set searched text in input field on click of search button
$(document).on("click", "#to-show-list a", function() {
$("#to-input").val($(this).text());
$("#to-show-list").html("");
});
像這樣使用 css 將最大高度應(yīng)用于結(jié)果 div。
<div id="from-show-list" class="list-group" style="max-height: 100px; overflow: auto;"></div>
<div id="to-show-list" class="list-group" style="max-height: 100px; overflow: auto;"></div>
添加回答
舉報(bào)