jQuery was created by John Resig in 2006 to address browser incompatibilities and simplify HTML DOM manipulation, event handling, animations, and AJAX.
For over a decade, jQuery was the most widely used JavaScript library worldwide. However, since JavaScript Version 5 (2009), many of jQuery’s features can now be accomplished with just a few lines of standard JavaScript.
Set the text content of an HTML element.
myElement.text(“Hello Sweden!”); |
myElement.textContent = “Hello Sweden!”; |
Retrieve the text content of an HTML element.
myText = $(“#02”).text(); |
myText = document.getElementById(“02”).textContent; |
Set the content (HTML) of an element.
myElement.html(“<p>Hello World</p>”); |
myElement.innerHTML = “<p>Hello World</p>”; |
Retrieve the HTML content of an element.
content = myElement.html(); |
content = myElement.innerHTML; |