Breathing jQuery – Part 1

No doubt jQuery is launched long back, but today after a long time I am learning something new, that’s jQuery. jQuery has got a good hype and is more easy to implement comparing to JavaScript.

BASIC:

Version: jQuery 1.4.2
Download: http://docs.jquery.com/Downloading_jQuery
Requires: script tag with jQuery file as src.

$(document).ready(function() {                          //launch code on document ready.
            $(“a”).click(function(event) {                  //add click event on all anchor tags of the document.
                alert(“Click before redirecting”);         //alert in popup before redirect to anchor tag url.
                event.preventDefault();                       //it will prevent default event of anchor tab, in short will not call href.
            });
        });
Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.