A strange problem. I have the following code:
var $addDegreeRow = $('.addDegreeRow').remove();
$('#addDegreeLink').click(function (ev) {
ev.preventDefault();
$('.degreeSection').append($addDegreeRow);
});
I select an element from the DOM by deleting it and storing its contents in the selector $addDegreeRow. Then I assign a click event to the link on the page that adds the saved selector to the existing div on the page.
The first time I click on an event, everything works fine. But the second time through nothing is added. And if I look at the HTML in firebug, the div .degreeSectionwill be highlighted every time I click, even if nothing is added. How jQuery rewrites an old $addDegreeRowappend with a new one, rather than just adding another one.
Has anyone encountered this problem before? Thank.