Extending jQuery with jQuery.Extend

We all know that jQuery is a great JavaScript framework. It’s provide lots of functionalities and most used framework in programming world. But sometimes we need a functionality that does not provided by jQuery by default. At that time we need to extend jQuery. We can extend jQuery with jQuery.Extend  Method. You can get complete information from the following link.


It merges the contents of two or more objects together into the first object.

Example of jQuery Extend:

Let’s take an example for jQuery.Extend so you can understand it better. In this example we will extend jQuery to print array. Following is a code for that.

<script type="text/javascript">
        function () {
            var car = new Array();
            car[0] = "Audi";
            car[1] = "Volvo";
            car[2] = "BMW";
        printArray: function( array) {
            jQuery.each(array, function (index, item) {

Here in the above code I have created a array in document.ready function of jQuery and then I have used jQuery.Extend method to extend jQuery and print array. In print Array method I have used console.log to print array item.

Now when you run this example in Internet explorer developer tool bar. You will get array output as expected.


You can see it’s very easy to extend jQuery with jQuery.Extend. That’s it. Hope you liked it. Stay tuned for more..


Popular posts from this blog

Creating PDF with ASP.Net MVC and RazorPDF

Horizontal and vertical scrollbar in HTML5 and CSS3

How to create Rest API(Web API) with ASP.NET Core 1.0