输入字段,例如stackOverflow标签输入字段 [英] Input field like stackOverflow tags input field

查看:68
本文介绍了输入字段,例如stackOverflow标签输入字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在JSF中使用素数.我需要一个输入组件,该组件允许用户在单个输入字段中最多提交5个标签,就像stackOverflow上的标签输入字段一样.还必须有一个功能来建议标签(当用户开始键入时),因为这里可用.

I am using primefaces with JSF. I need a input component that allows users to submit upto 5 tags in a single input field just like the tags input field on stackOverflow. There must be also a functionality to suggest the tags(as the user starts typing) as it is available here.

我找不到使用Primefaces组件的方法.有什么更好的方法来实现这一目标?

I couldnt figure out a way to do so using Primefaces components. What could be a better way to achieve that ?

推荐答案

您可以使用 jquery自动完成符合您目的的插件.

You can use jquery Autocomplete plugin for your purpose.

适合您的示例:

<script type="text/javascript">
    $(document).ready(function () {
        $("#myID").autocomplete('/Urlthatreturns/results', { multiple: true,
           multipleSeparator: "," }).result(function (event, item) {
        });
    });
</script>

这篇关于输入字段,例如stackOverflow标签输入字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆