Category Archives: jQuery

Method Chaining in Javascript

Method chaining is a technique that can be used to simplify code in scenarios that involve calling multiple functions on the same object consecutively. This chain is just a single expression. It’s easy enough to break this chain down and make each of the calls into separate expressions, but then it would obviously not be… Read More »

“Thinking in AngularJS” if I have a jQuery background?

1. Don’t design your page, and then change it with DOM manipulations In jQuery, you design a page, and then you make it dynamic. This is because jQuery was designed for augmentation and has grown incredibly from that simple premise. But in AngularJS, you must start from the ground up with your architecture in mind. Instead… Read More »

Features of jQuery 1.4 Released

jQuery 1.4 was recently released. This wasn’t simply a maintenance release as some had speculated; there are many new features, enhancements and performance improvements included in 1.4! This post covers the new features and enhancements that you may find beneficial. You can download jQuery 1.4 right now, here: http://code.jquery.com/jquery-1.4.js 1. Passing Attributes to jQuery(…) Pre… Read More »

Trigger in jQuery

The trigger() method triggers the specified event. It is similar to the triggerHandler() method, except that triggerHandler() does not trigger the default behavior of the event. Trigger events are not limited to browser-based events, you can also trigger custom events registered with bind. Syntax: $(selector).trigger(event,eventObj,param1,param2,…) Example: <html> <head runat=”server”> <title>Trigger example</title> <script src=”https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js”></script> <script> $(document).ready(function… Read More »

Add table row in jQuery

Here I will explain how to add table row in jQuery. We can use .append() method to add another row in table as you can see in the below example. <html> <head runat=”server”> <title></title> <script src=”https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js”></script> <script> $(document).ready(function () { $(“tr :last”).append(‘<tr><td>add by jQuery</td></tr>’) }); </script> </head> <body> <form id=”form1″ runat=”server”> <div> <table> <tr> <td>… Read More »

Clear JS and CSS cache in jQuery

You can’t clear client system browser cache using jQuery or javascript but you can clear your application cache pragmatically. $(‘.button’).click(function() { $.ajax({ url: “”, context: document.body, success: function(s,x){ $(‘html[manifest=saveappoffline.appcache]’).attr(‘content’, ”); $(this).html(s); } }); }); or you have to disable the cache control <meta http-equiv=’cache-control’ content=’no-cache’> <meta http-equiv=’expires’ content=’0′> <meta http-equiv=’pragma’ content=’no-cache’>

Filters in jQuery

It allow you to select a specific element based on its position in a group of elements or returns elements that match with the certain criteria. Syntax: $(selector).filter(criteria,function(index)) we will explain some types of filter like first(), last() and eq(), filter() and not() . Exxample:- <!DOCTYPE html> <html> <head> <script src=”https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js”></script> <script> $(document).ready(function(){ $(“p”).filter(“.elem”).css(“background-color”, “yellow”);… Read More »

How can I make a redirect page using jQuery?

In jQuery, you can easily redirect page using window.location.href=’page_name’. But if you want to simulate an HTTP redirect, use location.replace. // similar behavior as an HTTP redirect window.location.replace(“http://wwwgeeksblood.com”); // similar behavior as clicking on a link window.location.href = “http://wwwgeeksblood.com”;