且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

JQuery的自动完成。如果无法找到项目,显示和QUOT; preSS Enter键插入自动完成"?

更新时间:2022-12-08 19:50:52

我不知道你如何让你自动完成的结果,但如果如你得到它的$ .getJSON()调用,填充组合的项目根据其结果(不只是给调用的结果直到控制)可以检查是否result.length == 0,如果是的话,加入其他的东西(像元件说preSS输入创建)来组合。

I don't know how you get you're autocomplete results, but if for example you're getting it in a $.getJSON() call, and filling the combo's items based on the result (and not just giving the result of the call straight to the control) you could check whether the result.length == 0, and if so, add something else (like an element saying "Press Enter to create") to the combo.

请表现出一定的code,如果你想要更多的precise答案!

Please show some code, if you want more precise answer!