开发者

Trying to make dynamically created element draggable

开发者 https://www.devze.com 2023-04-03 02:54 出处:网络
I\'m trying to create a dynamic input element that is draggable. Now the problem is I create an element but when I u开发者_JS百科se something like

I'm trying to create a dynamic input element that is draggable. Now the problem is I create an element but when I u开发者_JS百科se something like

$("#in"+index.toString()).draggable({cancel:true});

after I append it to the container div, it's not working. Basically it's not working for the dynamically created input element of a certain id. Here's the code and please feel free to point out problems. I could really use some help on this one. Thanks!

http://jsfiddle.net/ithril/hRCun/5/


The problem is that you are creating a new element that is not bound to the UI functions. I would suggest using clone(true,true) and then changing the parameters of the cloned element as need be. You can learn more about clone here. http://api.jquery.com/clone/

0

精彩评论

暂无评论...
验证码 换一张
取 消