bugl
bugl
HomeLearnPatternsPathsSearch
HomeLearnPatternsPathsSearch

Loading lesson path

Learn/JavaScript/Objects, Classes, and Advanced Patterns
JavaScript•Objects, Classes, and Advanced Patterns

JavaScript / jQuery HTML Elements

Flash cards

Review the key moves

1/4
Core idea

What is the main idea behind JavaScript / jQuery HTML Elements?

Lesson checks

Practice each idea before moving on

Short Mimo-style checks built from this lesson's code, terms, and sequence.

1Quick choice

Which statement best captures the main point of this lesson?

2Fill blank

Complete the missing token from the example code.

___.text("Hello Sweden!");
3Order

Put the learning moves in the order that makes the concept easiest to apply.

However, after JavaScript Version 5 (2009), most of the jQuery utilities can be solved with a few lines of standard JavaScript:
jQuery was created in 2006 by John Resig.
jQuery vs JavaScript

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.

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

Set Text Content

Set the inner text of an HTML element:

myElement.text("Hello Sweden!");
myElement.textContent = "Hello Sweden!";

Get Text Content

Get the inner text of an HTML element:

myText = $("#02").text();

JavaScript

myText = document.getElementById("02").textContent;

Set HTML Content

Set the HTML content of an element:

myElement.html("<p>Hello World</p>");
myElement.innerHTML = "<p>Hello World</p>";

Get HTML Content

Get the HTML content of an element:

content = myElement.html();
content = myElement.innerHTML;

Previous

JavaScript / jQuery DOM Selectors

Next

JavaScript / jQuery CSS Styles