【问题标题】:Tag-it : how to store value in hidden input?Tag-it:如何在隐藏输入中存储价值?
【发布时间】:2017-01-28 15:41:45
【问题描述】:

我搜索了 2 天,但在我的情况下没有任何效果...

我使用带有强制自动完成功能的 tag-it (jquery): 用户只能从自动完成列表创建标签。 列表由 ajax 提供。 它使用 li html 标签。它运作良好。

实际上值存储在可见范围和隐藏输入中。 我现在只需在隐藏输入中存储一个值。 不难,但我尝试了很多脚本,但没有一个适合我的情况......

我的javascript:

$("#myTags").tagit({
    tagSource: function(request, response) 
    {
        $.ajax({
            data: { term:request.term },
            type: "POST",
            url:        "ajax_tagit_autocomplete.php",
            dataType:   "json",
             success: function( data ) {
                 array = data;
                response( $.map( data, function( item ) {
                    return {
                        label:item,
                        value: item
                    }
                    }));
                }
        	});
        },
    tagLimit :3,
    onTagLimitExceeded: function(event, ui) {
        alert("Vous ne pouvez pas choisir plus de 3 options");
    }, 	
}); 

您能帮我添加语句以更新隐藏的输入值吗? 非常感谢

【问题讨论】:

    标签: tag-it


    【解决方案1】:

    为了更好地理解: The html generated by TagIt

    【讨论】:

    • 我是个穷人...无法同时进入: - 使用 Ajax 查询自动完成 - 标签必须在列表中。不允许使用“免费”标签。 - 我在 2 天后尝试加载时已经显示了一些标签。也许明天我会发现魔法脚本......并且总是无法在此处插入换行符!行尾 2 个空格无效...
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-03-27
    • 1970-01-01
    • 1970-01-01
    • 2011-03-27
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多