开发者

issue when Upgrading to jQuery 1.5.1

the delete link don't work when I upgrading from jquery 1.5 to jquery 1.5.1开发者_如何学编程:

Demo: http://jsfiddle.net/EfsGN/


This was a bug with the clone() method that was introduced in jQuery 1.5, and fixed in 1.5.1.

The default behaviour with clone() should be to not copy the events and data of the cloned element, however this was not the case with 1.5 (where the default behaviour was to copy the events).

To fix your code, change:

$('#add-input').click(function() {
    main.append(clonedField.clone());
    return false;
});

to

$('#add-input').click(function() {
    main.append(clonedField.clone(true));
    return false;
});

Working fiddle: http://jsfiddle.net/EfsGN/7/

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜