Win a copy of Pro Spring MVC with WebFlux: Web Development in Spring Framework 5 and Spring Boot 2 this week in the Spring 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Bear Bibeault
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh

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: 12997
281
  • 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: 67537
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: 733
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.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic