user1382306
user1382306

Reputation:

change all ids in $.html() (or better ie7 clone alternative)

After much banging my head against the wall, I found this: http://bugs.jquery.com/ticket/9777 Yay!

My problem is that when I $.clone() an element in ie7 and try to change all ids with $myClonedElement.find("*[id]").andSelf().each(function() { $(this).attr("id", $(this).attr("id") + "-" + idNumberVariableForDynamicDatabasePagination); });, the ids for the clone also change.

I'm guessing I should use $.html() instead (if you have a better alternative, please suggest it), and append '-' + idNumberVariableForDynamicDatabasePagination to each id.

How can I do this?

Upvotes: 0

Views: 146

Answers (1)

Kevin B
Kevin B

Reputation: 95047

Avoid the bug by not using .attr, according to the bug report you linked to.

this.id = this.id + "-" + somenumber

I don't have a real version of IE7 to test this with.

Upvotes: 1

Related Questions