0

我有一个场景是

Index.jsp,包括一个 js 文件,比如 temp.js,10 个来自后端的 JSON 数据,在 jquery 中,我正在使用 onclick 属性对象 = [] 创建锚标记

(for i=0;i<10;i++)
 object = new Object();
  //setting the different attributes of this object and passing index to the onclick function
 <a href="modal.jsp" onClick(i) ></a>

Onclick 正在打开引导模式并在引导模式中 div.say #actionModal 在 Index.jsp 中,模式的主体是用 modal.jsp 编写的

modal.jsp 包含一个表单,我必须在单击 index.jsp 页面中生成的相应锚标记后填写该表单,并且我有与之关联的数据。

现在,如果我想填写 modal.jsp 中的所有表单,我必须再次调用这个 temp.js,那么只有 jquery 可以填写访问 Id.As 的表单元素,它是在执行 erlier js 文件后加载的。但我不想那样做。实现这种情况的最佳方法是什么。

我希望我向所有人表达了我的疑问;)

4

1 回答 1

0

这已经回答过几次了。

使用 jquery on() 函数。

未来元素的 jQuery .on 函数,因为 .live 已被弃用

http://api.jquery.com/on/

于 2013-10-11T12:56:30.967 回答