Wednesday, May 15, 2019

Client side development - JQuery


                                                Client side development - JQuery

The jQuery syntax is custom-made for selecting HTML elements and executing actions on elements. The basic syntax is $ (selector). action () A $ sign to set / access jQuery. A (selector) to "query" the HTML elements. A jQueryaction () to perform on the elements.

The jQuery syntax is custom-made for selecting HTML elements and executing actions on elements.

Examples:
• $ (this) .hide () - hide the current item.
• $ ("p"). Hide () - hide all <p> elements.
• $ ("# test"). Hide () - hide the element with id = "test".
• $ ("Test"). Hide () - hide all elements with class = "test".

jQuery is a fast, small and feature rich JavaScript library. It dramatically simplifies the navigation and manipulation of HTML documents, event management, animation and Ajax with a simple-to-use API that works across a multitude of browsers.
The key difference between a library and a framework is Inversion of Control. When you call a method from a library, you are in control. But with a framework, the control is inverted, the framework calls you.
A library is just a collection of class definitions. The reason behind is simply code reuse, i.e. get the code that has already been written by other developers. The classes and methods normally define specific operations in a domain specific area.



In framework, all the control flow is already there, and there's a bunch of predefined white spots that you should fill out with your code. A framework is normally more complex. It defines a skeleton where the application defines its own features to fill out the skeleton. 
This video show more information about "Is jQuery a framework or a library?".


The jQuery library contains the following features:
·                  CSS manipulation
·                  HTML/DOM manipulation
·                  Effects and animations
·                  Utilities
·                  AJAX

The 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.

The advantages of jQuery



The main advantage of jQuery is that it is much easier than its competitors. You can add plugins easily, translating this into a substantial saving of time and effort. In fact, one of the main reasons why Resig and his team created jQuery was to buy time (in the web development world, time matters a lot).

The open source license of jQuery allows the library to always have constant and fast support, constantly publishing updates. The jQuery community is active and extremely hardworking.

Another advantage of jQuery over its competitors such as Flash and pure CSS is its excellent integration with AJAX.



In summary:

jQuery is Mexible 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






The main advantage of jQuery is that it is much easier than its competitors. You can add plugins easily, translating this into a substantial saving of time and effort. In fact, one of the main reasons why Resig and his team created jQuery was to buy time (in the web development world, time matters a lot).

The open source license of jQuery allows the library to always have constant and fast support, constantly publishing updates. The jQuery community is active and extremely hardworking.

Another advantage of jQuery over its competitors such as Flash and pure CSS is its excellent integration with AJAX.



In summary:

jQuery is Mexible 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


Keep Private Functions Private

The technique of exposing part of your plugin to be overridden can be very powerful. But you need to think carefully about what parts of your implementation to expose. Once it's exposed, you need to keep in mind that any changes to the calling arguments or semantics may break backward compatibility. As a general rule, if you're not sure whether to expose a particular function, then you probably shouldn't.

So how then do we define more functions without cluttering the namespace and without exposing the implementation? This is a job for closures. To demonstrate, we'll add another function to our plugin called "debug". The debug function will log the number of selected elements to the console. To create a closure, we wrap the entire plugin definition in a function (as detailed in the jQuery Authoring Guidelines).

The css() method sets or returns one or more style properties for the selected elements.When used to return properties: This method returns the specified CSS property value of the first matched element.


The html() method sets or returns the content of the selected elements.When this method is used to return content,it returns the content of the first matched element.When this method is used to set content,it overwrites the content of the all matched elements.


The main advantage of jQuery is that it is much easier than its competitors. You can add plugins easily, translating this into a substantial saving of time and effort. In fact, one of the main reasons why Resig and his team created jQuery was to buy time.

The open source license of jQuery allows the library to always have constant and fast support, constantly publishing updates. The jQuery community is active and extremely hardworking.

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.

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.
·        Provide Callback Capabilities
·         
·        What is a callback? – A callback is essentially a function to be called later, normally triggered by an event. It's passed as an argument, usually to the initiating call of a component, in this case, a jQuery plugin.
·         
·        If your plugin is driven by events then it might be a good idea to provide a callback capability for each event. Plus, you can create your own custom events and then provide callbacks for those. In this gallery plugin it might make sense to add an "onImageShow" callback.


jQuery selectors allow you to select and manipulate HTML element(s).jQuery selectors are used to "find" (or select) HTML elements based on their name, id, classes, types, attributes, values of attributes and much more. It's based on the existing,CSS Selectors., and in addition, it has some own custom selectors.All selectors in jQuery start with the dollar sign and parentheses.To use any of the meta-characters (such as (!"#$%&'()*+,./:;<=>?@[\]^`{|}~ ) as a literal part of a name, it must be escaped with two backslashes. 

DOM and DOM Elements. The Document Object Model (DOM) is a representation of an HTML document.

The Document Object Model (DOM) is a programming interface for HTML and XML documents. It represents the page so that programs can change the document structure, style, and content. The DOM represents the document as nodes and objects.

DOM processing is the time it takes to parse the HTML into a DOM and retrieve or execute synchronous scripts.This phase measures browser-side processing of the page content, and often includes time for scripts and static assets to load.


Definition and Usage. The ready event occurs when the DOM has been loaded. Because this event occurs after the document is ready, it is a good place to have all other jQuery events and functions. Like in the example above. The ready() method specifies what happens when a ready event occurs.


No comments:

Post a Comment