Elegant Way Around Htmlcollections Updating Dynamically
Today, I discovered something in Javascript that looked like 'strange behavior' to me. Let's assume the following minimal example: HTML:
1<
Solution 1:
A back-gate would be to use querySelectorAll()
instead of getElementsByTagName()
, it returns a non-live NodeList.
Solution 2:
You're not using a "reference" when trying to remove the tag, just pointing the first or the second element of a collection. To use reference, you should create tags with ID and than point it by ID. The key of an Array is a third part, that's why it will be updated.
On the other hand, is a fact that JavaScript is objected-oriented sometimes, and other times it is just a script.
Post a Comment for "Elegant Way Around Htmlcollections Updating Dynamically"