Client side development -jQuery


Hello friends. In this blog I'm going to talk about jQuery.


jQuery is not a framwork. It is a fast, small, and feature-rich JavaScript library. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers. With a combination of versatility and extensibility, jQuery has changed the way that millions of people write JavaScript.

The purpose of jQuery is to make it much easier to use JavaScript on your website.
jQuery takes a lot of common tasks that require many lines of JavaScript code to accomplish, and wraps them into methods that you can call with a single line of code.

The jQuery library contains the following features:
  • HTML/DOM manipulation
  • CSS manipulation
  • HTML event methods
  • Effects and animations
  • AJAX
  • Utilities
There are lots of other JavaScript frameworks out there, but jQuery seems to be the most popular, and also the most extendable.
Many of the biggest companies on the Web use jQuery, such as:
  • Google
  • Microsoft
  • IBM
  • Netflix

Advantages of jQuery

  • jQuery is flexible and fast for web development
  • It comes with an MIT license and is Open Source
  • It has an excellent support community
  • It has Plugins
  • Bugs are resolved quickly
  • Excellent integration with AJAX
in  jQuery mobile
  • It is compatible with most mobile platforms: iOS, BlackBerry, Windows Mobile, Symbian and Android.
  • As it is based on jQuery (logical), it does not have a large learning curve
  • Supports style themes
  • It is extremely light and fast

Disadvantages of jQuery

One of the main disadvantages of jQuery is the large number of published versions in the short time. It does not matter if you are running the latest version of jQuery, you will have to host the library yourself (and update it constantly), or download the library from Google (attractive, but can bring incompatibility problems with the code).
In addition to the problem of the versions, other disadvantages that we can mention:
  • jQuery is easy to install and learn, initially. But it’s not that easy if we compare it with CSS
  • If jQuery is improperly implemented as a Framework, the development environment can get out of control.

Using jQuery

1.Using the downloaded source 
                1.Download 
                2.Link -<script src=“jQuery.min.js”></script>  
                3.Use it in your code <script src=“myCode.js”></script>
2.Using CDN 
                1.Link -<script src=“CDNPath”></script> 
                2.Use it in your code <script src=“myCode.js”></script>


Ways to use jQuery API

jQuery(<selector>); ->jQuery(document);
$(<selector>); ->$(document);

*document provides access to the current page
JS may execute before the page loads

Selectors in jQuery






Dom objects



The Document Object Model (DOM) is a programming interface for HTML and XML(Extensible markup language) documents. It defines the logical structure of documents and the way a document is accessed and manipulated.

 DOM is a way to represent the webpage in the structured hierarchical way so that it will become easier for programmers and users to glide through the document. With DOM, we can easily access and manipulate tags, IDs, classes, Attributes or Elements using commands or methods provided by Document object.

Structure of DOM:
DOM can be thought of as Tree or Forest(more than one tree). The term structure model is sometimes used to describe the tree-like representation of a document. One important property of DOM structure models is structural isomorphism: if any two DOM implementations are used to create a representation of the same document, they will create the same structure model, with precisely the same objects and relationships.
•jQuery provides API to traverse through the DOM 
•These DOM navigating APIs are faster than advanced CSS like selectors
•Can navigate through the DOM, element by element


Events

jQuery provides simple methods for attaching event handlers to selections. When an event occurs, the provided function is executed. Inside the function, this refers to the DOM element that initiated the event.
The event handling function can receive an event object. This object can be used to determine the nature of the event, and to prevent the event’s default behavior.






Comments

Popular posts from this blog

How to run multiple Transformations from one Job in Pentaho

Data Analytics

Distributed Systems