All jQuery Codes

jQuery code to disable double click event

jQuery code to disable double click event on the webpage. $(document).ready(function(){ $("*").dblclick(function(e){ e.preventDefault(); }); }); Above jQuery code will disable double click event for all the controls on the webpage. If you want to disable for specific control, let's say a button with ID "btnSubmit" then, $(document).ready(function(){ $('#btnSubmit').dblclick(function(e){ e.preventDefault(); }); }); Feel free to contact […]
Read the rest of this entry »

Check/uncheck checkboxes in Asp.net GridView using jQuery

Find out jQuery code to check/uncheck or select/deselect all the checkboxes in ASP.NET Gridview. There are already plenty of articles on this topic but then how this is different. Assume, all the checkboxes are checked when header checkbox is checked but then you uncheck one of the child checkbox then what happens to your header […]
Read the rest of this entry »

jQuery to highlight GridView Rows when Checkbox is checked in ASP.NET

In this post, Find out jQuery code to highlight ASP.NET Gridview row when checkbox is checked and restore it to original state when unchecked. Also Read: GridView and jQuery in ASP.NET How to do it? Bind the click event to all the checkbox of ASP.NET GridView. $('#<%=gdRows.ClientID%>') .find('input:checkbox[id$="chkDelete"]') .click( function() { }); In the click […]
Read the rest of this entry »

jQuery to clear textbox value using ESC key

Yesterday worked on interesting thing. Requirement was to clear the textbox text when escape (Esc) key is pressed within textbox. This was easy and simple. Bind keyup event with textbox/textboxes. Check the keycode. If keyCode is 27 (which is for esc key) then clear the text. $(document).ready(function() { $('input[type="text"]').keyup(function(e){ if(e.keyCode == 27) { $(this).val(''); } […]
Read the rest of this entry »

jQuery to style Hyperlinks based on URL extension

Yesterday I was working on a requirement where I need to apply different styles to hyperlinks based on their URL extensions. For example, if there are hyperlinks which redirects to ".pdf" extension then change their font color to "Red" so that they look different from other hyperlinks. This was easy to implement using jQuery. What […]
Read the rest of this entry »

jQuery to disable submit button to prevent duplicate postback

Well, it is quite possible that user may click the submit button more than once to post the data. Which in turn may lead to duplicate postback. And it may create problems like duplicate insertion of records, if not handled properly. So it is preferable to disabled the submit button once it is clicked so […]
Read the rest of this entry »

Responsive Menu
Add more content here...