2

I'm new to javascript and I can't seem to figure out this thing which I reckon should be a no-brainer.

I'm using Jquery mobile. I would like to clone a div and update the IDs of the elements in it. This seems to work fine. However, I can't get the cloned select element to work properly. I doesn't seem to work - I can't select anything - after its been cloned. When I call an extra $('html').trigger('create'); on the page the select elements starts looking 'funny' (probably because it got enhanced a second time) but does works.

I've posted a simplified version of my code here: http://jsfiddle.net/cUBPF/1/

Does anyone have a suggestion for me? Thanks!

4

1 回答 1

0

我没有遇到任何问题,但我只是在使用我的桌面。我的第一个想法是完全避免调用$('html').trigger('create');,只需在 clone_button 点击​​中做你想做的事,但话又说回来,我不确定你在做什么。

与其做所有这些,为什么不输出 10 或 20 个这些字段和 display:none/display:block 它们......我假设你会遇到这样的兼容性问题,你真的不想允许无限数量的字段....您将遇到浏览器内存问题,这只会导致更多错误。

于 2013-08-26T20:30:17.797 回答