JS HTML DOMLesson #289

jQuery HTML DOM

[jQuery](/jquery/default.asp) was created in 2006 by John Resig. It was designed to handle Browser Incompatibilities and to simplify HTML DOM Manipulation, Event Handling, Anima...

jQuery vs JavaScript

jQuery was created in 2006 by John Resig. It was designed to handle Browser Incompatibilities and to simplify HTML DOM Manipulation, Event Handling, Animations, and Ajax.

For more than 10 years, jQuery has been the most popular JavaScript library in the world.

However, after JavaScript Version 5 (2009), most of the jQuery utilities can be solved with a few lines of standard JavaScript:


Share

Removing HTML Elements

Remove an HTML element:

jQuery

Example Code

javascript
Try it Yourself
$("#id02").remove();

JavaScript

Example Code

javascript
Try it Yourself
document.getElementById("id02").remove();

Get Parent Element

Return the parent of an HTML element:

jQuery

Example Code

javascript
Try it Yourself
myParent = $("#02").parent().prop("nodeName"); ;

JavaScript

Example Code

javascript
Try it Yourself
myParent = document.getElementById("02").parentNode.nodeName;


Interactive Code Examples

jQuery

javascript
Try it Yourself
JavaScript syntax and algorithm demonstration.
$("#id02").remove();

JavaScript

javascript
Try it Yourself
Interactive runnable JavaScript example from EA Academy.
Live Output Preview:

jQuery

javascript
Try it Yourself
JavaScript syntax and algorithm demonstration.
myParent = $("#02").parent().prop("nodeName"); ;

JavaScript

javascript
Try it Yourself
Interactive runnable JavaScript example from EA Academy.
Live Output Preview: