在div中加载的页面上应用jquery稍后在bootstrap模式中说

时间:2013-10-11 12:03:47

标签: javascript jquery html

我的情景是

Index.jsp,包括一个js文件说temp.js,10个来自后端的数据作为JSON和jquery我用onclick属性创建锚标签     object = []

(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正在打开bootstrap模态,并在Index.jsp中的bootstrap模态div.say #actionModal中,modal的主体用modal.jsp编写

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

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

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

1 个答案:

答案 0 :(得分:0)

已经回答了几次。

使用jquery on()函数。

jQuery .on function for future elements, as .live is deprecated

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