0
段:結合嘰嘰喳喳預輸入與HTML的JSF的inputText
<h:panelGrid width="100%">
<h:outputText value="From:"></h:outputText>
<h:inputText id="departureAirport" value="#{searchFlightsBean.departureAirport}" styleClass="input-block-level blue-highlight" placeholder="Enter departure city" required="true">
<f:validateLength minimum="3" maximum="20" />
</h:inputText>
<h:message for="departureAirport" styleClass="alert alert-error" />
</h:panelGrid>
我想,最終,通過AJAX提取數據用於這一領域,並建議選項,用戶在他/她打字。
我已經包含在我的網頁下面:
<h:outputStylesheet name="css/bootstrap.css" />
<h:outputStylesheet name="css/main.css" />
<h:outputScript name="js/jquery-2.0.2.min.js" />
<h:outputScript name="js/bootstrap-typeahead.js" />
和我有以下的JS,我使用的測試自動完成,其中:
$(document).ready(function() {
$('#departureAirport').typeahead([ {
name: 'planets',
local: [ "Mercury", "Venus", "Earth", "Mars", "Jupiter", "Saturn", "Uranus", "Neptune" ]
}]);
});
自動完成是不加工。有誰知道爲什麼,確切地說? 如果有人感興趣,我得到了前面的例子here。
只是提到:使用中的typeahead是**不是**大多數人從twitter-bootstrap知道的,但是https://github.com/twitter/typeahead.js。 – davidkonrad
我不知道有一個包含在twitter-bootstrap中,非常誠實。 這就是我這樣做的主要原因。 – Skytiger
有/有兩種不同類型的頭。從bootstrap v3(最新版本),舊版本的老版本被替換爲Twitters Typeahead https://github.com/twbs/bootstrap/issues/7747 [困惑?所以,我:-)會提及它,因爲我立即根據「舊」typeahead找出錯誤,直到意識到它是Twitter Typeahead ... – davidkonrad