There are a couple of issues with this patch. Using the component multiple times will lead to duplication in ids across the DOM which is not permitted. If addNewNode is called from multiple places at the same time, the id and content attr might not have the same value in lastid anymore. You're assigning values to a semi-global var in a very narrow scope, won't introduce bugs, but hard to see the assignment when it's hidden like that.
Changing it to be a random string that gets created inside addNewNode instead removes all those issues.