我们如何创建调用jquery自动完成功能的多个字段? [英] how can we create multiple field which calls the jquery autocomplete ?

查看:65
本文介绍了我们如何创建调用jquery自动完成功能的多个字段?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

实际上我想做的是,当我创建div的另一个克隆时,我的自动完成jQuery无法正常工作吗?

Actually what i want to do is when i create another clone of the div my autocomplete jquery doesnt work?


@ Html.DropDownList("Deep",(IEnumerable< SelectListItem>)ViewBag.Address,",new {@class ="combobox"})

@Html.DropDownList("Deep", (IEnumerable<SelectListItem>)ViewBag.Address, "", new { @class = "combobox" })



为了使之成为可能,该怎么办?
在此先感谢



what can be done in order to make that possible?
Thanks in advance

推荐答案

我不认为您可以拥有两个具有相同ID的元素.创建两个ID,并将它们绑定在一起以在代码中自动完成.无论如何,您都需要不同的ID来查找这两个值,并且您应该旨在创建一个视图模型并使用DropDownListFor,除非您正在使用AJAX将选定的值传回(这仍然意味着您需要将它们分开)
I don''t think you can have two elements with the same id. Create two ids and tie them both to autocomplete in your code. You need different ids to look the two values up anyhow, and you should aim to create a viewmodel and use DropDownListFor, unless you''re using AJAX to pass the selected values back ( which still means you need to tell them apart )


这篇关于我们如何创建调用jquery自动完成功能的多个字段?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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