Java Reference
In-Depth Information
A framework is a library of JavaScript code that provides several methods that make it easi-
er to achieve common tasks. JavaScript is an extremely flexible language that can accom-
plish most programming tasks ... but not all undertakings are as easy to do as they should be.
A framework will abstract functionality into easier-to-use functions and methods. These can
then be used to achieve common assignments without having to use lots of repetitive code.
DOM Manipulation Example
A good example of how frameworks can help save time is in DOM manipulation. The DOM
API provides all the tools required to manipulate the DOM, but some can be verbose and
take several lines of code to attain even the most basic of tasks.
For example, if we wanted to add a class to a paragraph element stored in the variable para ,
then append another paragraph on the end, we could do it using the following:
var newPara = document.createElement("p");
newPara.textContent = "Another Paragraph";
Yet by using the jQuery framework, we can achieve the same result using a single line of
So you can see how using a framework can reduce the amount of code you have to write, as
well as making common tasks easier to implement.
jQuery is the most popular of all the JavaScript frameworks used today, as seen in these stat-
istics on W3Techs and Built With. It is used in a huge number of commercial websites and
Search WWH ::

Custom Search