aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes Removing DOM Element in jQuery Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Removing DOM Element in jQuery" Watch "Removing DOM Element in jQuery" New topic
Author

Removing DOM Element in jQuery

Ashwin Sridhar
Ranch Hand

Joined: Jul 09, 2011
Posts: 272

Hi,

I am learning DOM structure in jQuery and trying to remove the parent element. Below is my code .



When I remove the parent of .fish, I assume the <ui> element within Spanish Combo to be removed, but all the elements are getting removed.

Could someone explain this.


Ashwin Sridhar
SCJP | SCWCD | OCA
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61434
    
  67

When your HTML is invalidly structured, and even uses elements that don't actually exist, anything could happen. You should not be surprised that things go awry.

Before doing anything, validate your HTML and fix the problems.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Use this to see your errors: http://validator.w3.org/
Ashwin Sridhar
Ranch Hand

Joined: Jul 09, 2011
Posts: 272



Use this to see your errors: http://validator.w3.org/


This helped me to figure out problems with my HTML structure. Thank you.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Removing DOM Element in jQuery