while I deeply respect to sunfighter's opinion (I also enjoy his solution types in general),
I do not think that w3scools would be a good source.
Ditto. The train wreck of outdated web-rot mated to scam-artist dirtbaggery is the last place anyone should go to learn anything. Their methodologies are flawed, and in general their information is wrong, broken, and misleading.
There's a reason it's oft referred to as "W3Fools". Worse being the fact they basically spent over a decade suckering people into thinking they had ANYTHING to do with the W3C
(they don't) to hock their stupid meaningless "certifications"... and an entire parody site and harassment campaign existed at one point just to get them to add a disclaimer "we're not part of the W3C"...
that's now buried on some sub-page.
Better sources are available.
Like MDN, which is the official source according to the W3C.
Since the official W3C HTML specifications aren't written for web developers, but for browser developers.
Let me just say that again, the official specification for the language used to make websites isn't written for people who make websites. It's written for people who make browsers and they magically expect third parties to pick up the slack. In that context is it a wonder
[URL='https://medium.com/me/stats/post/2dfb62755280']nobody seems to be using HTML properly?[/url] particularly when dirtbags like W3Fools are in the mix?!?
Hence these pages:
https://developer.mozilla.org/en-US/docs/Web/API/Node/removeChild
https://developer.mozilla.org/en-US/docs/Web/API/Node/appendChild
https://developer.mozilla.org/en-US/docs/Web/API/Node/insertBefore
Are vastly superior to W3Fools incompetent BS.
Note, insertBefore FIRST can actually be more efficient/less code, and a insertBefore or appendChild of a node already on the DOM will automatically remove it from it's old location first.
NOW, as to the whole Java and JavaScript thing, given that JAVA doesn't exist in the browser except as a plugin, that most people won't install; Oracle Stopped updating; Even Oracle advises against enabling in the browser now; and most people will tell you to go plow yourself (even stronger language may be involved) if you ask them to install it these days...
if you want this to happen in the HTML client side Java isn't even a viable option/choice.
Remember: Java is to JavaScript as Ham is to Hamburger.
Now all that said, @
scristaldi could you better explain -- possibly in non-broken English -- what it is you're even trying to accomplish? I've reread both your posts three times and honestly given the behavior in question is built into all modern browsers, I too wonder just what you're on about. Your second post in particular makes zero sense to me. I cannot decipher what it is you're even trying to say/do.