jQuery- FB 輸入後自動附加效果
最近在苦惱寫類似facebook,輸入一定程度後會有提示,然後可以附加到輸入欄內,但跟我以往認知的html寫法不一樣,先找plugin,可是跟目前想要做的東西還是有點差異,但還是先記錄一下。
plugin網址:
FCBKcomplete
HTML長這樣
- <div id="text"></div>
- <form action="submit.php" method="POST" accept-charset="utf-8">
- <select id="select3" name="select3">
- <option value="sleep" class="selected">sleep</option>
- <option value="sport">sport</option>
- <option value="freestyle">freestyle</option>
- </select>
- <input type="submit" value="Send">
- </form>
<div id="text"></div> <form action="submit.php" method="POST" accept-charset="utf-8"> <select id="select3" name="select3"> <option value="sleep" class="selected">sleep</option> <option value="sport">sport</option> <option value="freestyle">freestyle</option> </select> <input type="submit" value="Send"> </form>
引plugin
- $("#select3").fcbkcomplete({
- json_url: "data.txt",
- addontab: true,
- maxitems: 10,
- input_min_size: 0,
- height: 10,
- cache: true,
- newel: true,
- select_all_text: "select",
- });
Demo
還是先研究html好了..
留言