All jQuery Codes

jQuery: Convert ASP.NET GridView Data into CSV

In this post, find jQuery code to convert ASP.NET GridView data into CSV format which is sometimes quite useful for exporting purpose. This can be also be done using server side code but that involves extra overhead "postback". ASP.NET GridView control is rendered in table > th > tr > td format. The columns names […]
Read the rest of this entry »

How to restore CSS styles using jQuery

To assign inline css to any DOM element, we can jQuery ".css()" method to define it. Like, $("#dvText").css('color','#FF0000'); And if you need to remove the color again, then you can use the same css method to remove it. Like, $("#dvText").css('color',''); The above method to remove/restore the style is fine, when you have defined a single […]
Read the rest of this entry »

Fix for ASP.NET Checkbox -jQuery click event getting fired twice issue

This is really interesting. If ASP.NET checkboxes or checkbox list is placed within any container element like div or span, and click event is attached on checkbox. And then clicking on checkbox text will call click event twice. For example, consider the following HTML/ASP.NET code. <div id="dvList"> <asp:CheckBox ID="chk1" runat="server" Text="Check1" CssClass="Dummy" /> <asp:CheckBox ID="chk2" […]
Read the rest of this entry »

jQuery – Page Redirect after X seconds wait

You must have come across any website which uses a webpage with some annoying advertisement and a message that says "You will be redirected to actual page after X seconds". This can be easily implemented with jQuery. In this post, find jQuery code to redirect user to another webpage after specific time interval or few […]
Read the rest of this entry »

jQuery: Restrict occurrence of specific word in textbox

Below jQuery code allows to restrict user to enter any specific word only once in textbox. For demo, I have used "article" word and it should occur only once in textbox. The code also makes case insensitive search. $(document).ready(function () { $('#txtDesc').bind('keyup', function () { var txtToMatch = /article/gi; var iLimit = 1; var sMatch […]
Read the rest of this entry »

Detect Scroll Position (Up/Down) using jQuery

Below jQuery code detects whether user is scrolling up or down in the webpage. var iScrollPos = 0; $(window).scroll(function () { var iCurScrollPos = $(this).scrollTop(); if (iCurScrollPos > iScrollPos) { //Scrolling Down } else { //Scrolling Up } iScrollPos = iCurScrollPos; }); Live Demo Feel free to contact me for any help related to jQuery, […]
Read the rest of this entry »

Responsive Menu
Add more content here...