Win a copy of Programming with Types this week in the Angular and TypeScript forum
or The Design of Web APIs in the Web Services forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Knute Snortum
  • Henry Wong
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Frits Walraven
  • Joe Ess
  • salvin francis

removeNode(true) not working

 
Ranch Hand
Posts: 1609
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have below code and I am expecting a blank page to appear.

Why is that removeNode not removing everything?

 
Saloon Keeper
Posts: 11002
243
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Probably because removeNode() doesn't exist. What browser are you using? Do your developer tools display an error?
 
Marshal
Posts: 67336
171
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you have the browser debugger open while you are developing? That will show you the JavaScript errors.

Why aren't you use jQuery for this type of thing?
 
Akhilesh Trivedi
Ranch Hand
Posts: 1609
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On FireFox developer console I get

TypeError: myid_div.removeNode is not a function
 
Akhilesh Trivedi
Ranch Hand
Posts: 1609
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Bear Bibeault wrote:
Why aren't you use jQuery for this type of thing?



I am just working on the basics and practicing things.
 
Bartender
Posts: 1845
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A quick google discovered the following facts.

myid_div.removeNode() as a function does not exist.

myid_div.remove() exists, but isn't necessarily well supported ?

myid_div.parentNode.removeChild(myid_div) is the suggested workaround.


As has been suggested, if you are doing anything significant in javascript, use a framework to abstract the browser incompatibility problems away.

 
Ranch Hand
Posts: 729
7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Why is that removeNode not removing everything?


removeNode being a ms proprietary dom extension function would not (normally) be expected to be supported by its competitors, whereas it should work on IE though and it does. One should use dom  compliant functionality whenever it is possible to maximize the general support. This is how by using dom level 1 functionality (removeChild) to do that and the script is self-explanatory.
 
Akhilesh Trivedi
Ranch Hand
Posts: 1609
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

removeNode being a ms proprietary dom extension function would not (normally) be expected to be supported by its competitors



I thought of taking HTML CSS certificate exam from Microsoft. Thanks! I dropped it off from my list now.
 
Forget this weirdo. You guys wanna see something really neat? I just have to take off my shoe .... (hint: it's a tiny ad)
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!