Replacing a Widget
Replacing a Widget
To replace a widget I do something like this:
First I create a new DOM element w.
- $(w).attr('id', 'gromet');
- $('#gromet').after(w)
- $('#gromet').remove();
How can this work? Why doesn't it remove both the old and new widget. It seems to just remove the old one, perhaps because that's the first one it finds. I'm not complaining. This is working for me in multiple browsers. Is there a better way to replace a widget with a new one of the same id? I'd hate to get caught with bad code when someone "fixes" the current behavior.