1
是否可以將一些HTML追加到鍵入的末尾?我嘗試了很多不同的東西,但都沒有成功。追加到鍵入
我試圖做的是有預輸入的最後結果是Search for "< what the user typed into the input >"
。
這裏就是我試過上的jsfiddle:http://jsfiddle.net/MgcDU/8621/
我希望它做的是追加<li>
一次它的創建下拉結束,但事實並非如此。爲什麼?
HTML:
<input type="text" data-source="["Alabama","Alaska","Arizona","Arkansas","California","Colorado","Connecticut","Delaware","Florida","Georgia","Hawaii","Idaho","Illinois","Indiana","Iowa","Kansas","Kentucky","Louisiana","Maine","Maryland","Massachusetts","Michigan","Minnesota","Mississippi","Missouri","Montana","Nebraska","Nevada","New Hampshire","New Jersey","New Mexico","New York","North Dakota","North Carolina","Ohio","Oklahoma","Oregon","Pennsylvania","Rhode Island","South Carolina","South Dakota","Tennessee","Texas","Utah","Vermont","Virginia","Washington","West Virginia","Wisconsin","Wyoming"]" data-items="10" data-provide="typeahead" style="margin: 0 auto;" class="span3">
的jQuery:
$(".typeahead.dropdown-menu").append('<li data-value="Custom" class=""><a href="#">CUSTOM TEXT</a></li>');