• 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
  • Tim Cooke
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • paul wheaton
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Tim Holloway
  • Carey Brown
  • 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: 10534
224
  • 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: 67280
170
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.
 
You ought to ventilate your mind and let the cobwebs out of it. Use this cup to catch the tiny ads:
professionally read, modify and write PDF files from Java
https://products.aspose.com/pdf/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!