Cheerio
Cheerio

Reputation: 1240

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/

Upvotes: 1

Views: 269

Answers (1)

Matt
Matt

Reputation: 75317

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/

Upvotes: 5

Related Questions