Archive for March, 2011

Determine which key was pressed using jQuery

I had a requirement where I need to check which key was pressed by the User in the textbox and then take various action. So below is simple jQuery code to determine or find out which key was pressed. We are using keypress() event of jQuery to detect which key was pressed. <input type='text' id='txtValue' […]
Read the rest of this entry »

Useful jQuery code examples for ASP.NET Controls

Earlier I had posted about Using jQuery with ASP.NET and in this post, you will find list of some useful jQuery code example for ASP.NET controls that we use on daily basis. One thing, while creating object of any ASP.NET control, always use ClientID. As when Master pages are used then the ID of the […]
Read the rest of this entry »

jQuery code to allow numbers and arrow keys in textbox

I have already posted about "jQuery code to allow only numbers in textbox", but one of my reader asked me to allow arrow keys as well. I have modified the code slightly to allow arrow keys. I thought it's good idea to share with all my readers. See below jQuery code. $(document).ready(function(){ $("#txtNumbers").keydown(function(event) { if(event.shiftKey) […]
Read the rest of this entry »

Is window.onload is different from document.ready()

window.onload() is traditional Java script code which is used by developers from many years. This event is gets called when the page is loaded. But how this is different from jQuery document.ready() event? Well, the main difference is that document.ready() event gets called as soon as your DOM is loaded. It does not wait for […]
Read the rest of this entry »