Tag: JavaScript

Build your first jQuery plugin

First and far most, we should say thanks to John Resig and his team to make our life so easier then before by making jQuery, most demanding and powerful JavaScript framework and it’s expanding phenomenally that gives the proof of dominancy of jQuery framework.

So why do I need to extend jQuery?

Here we go; no library is full filling all the requirements so does jQuery, so there should be some mechanism to add sets of useful methods called as plugins for your specific requirement, which we can say in the basic terminology calling your external methods into your structure but it doesn’t give you the power of leverage existing code base.

Let’s say, by creating a new jQuery commands, we automatically inherit the use of powerful selector mechanism and can use all the jQuery methods and indeed it’s a good practice to make reusable code.

There is a pretty good documentation and guidelines available on jQuery Plugins/Authoring page.

Let’s start making our first jQuery plugin; we call our plugin as “disable”, we make our plugin to disable the form elements and then we will extend our default options using $.extend utility method to enable the required once.

We will follow the guidelines as provided on jQuery.com so we will save our plugin as jquery.disable.js

[sourcecode language=’js’]
// plugin definition
$.fn.disable = function() {
// plugin implementation code goes here.
};
[/sourcecode]

Read More

JavaScript outside the browser

http://javascript.weblogsinc.com/2006/08/06/javascript-outside-of-the-browser/

After reading the above article, questions comes in mind, why JavaScript outside the browser?

So let’s go through on some points which strongly recommend the future of “the world’s most misunderstood programming language”.

1. JavaScript will be treated as a significant programming language in the upcoming days
2. JavaScript speed and performance, of course would be increasing in the future of ECMAScript 4th edition
3. Increasing popularity of HELMA* using Rhino, it’s not as popular yet as it should be, would be hearing soon in the future about HELMA
4. Major enhancement of some JavaScript Engines like Rhino*, SpiderMonkey*
5. Popularity of Tamarin*

*Helma: It is an open source web application framework for fast and efficient scripting and serving of your websites and Internet applications.
Read More

Show Love to the Object Literal | Core JavaScript 1.5 Guide:Literals

Defining an object is via literal notation. Supported in JavaScript1.2 and above, it’s a more robust form of creating an object on the fly.
Neat and clean approach to write reusable, readable and maintainable JavaScript code.

Show Love to the Object Literal:
http://ajaxian.com/archives/show-love-to-the-object-literal

Object literals beauty lies in Namespaces, which reduces the number of global variables in your pages. It uses a technique known as branching, which allows you to use common utility
functions without worrying about browser sniffing. Read More

Loading...
X