• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
Sheriffs:
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
Bartenders:
  • Jesse Duncan
  • Frits Walraven
  • Mikalai Zaikin

removeNode(true) not working

 
Ranch Hand
Posts: 1609
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 14010
315
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Probably because removeNode() doesn't exist. What browser are you using? Do your developer tools display an error?
 
Sheriff
Posts: 67645
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 734
7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic