Two useful jQuery scripts for forms

Here are two useful jQuery scripts for online forms. The first is to prevent double submission of a form a.k.a. ‘anti-double-click’. $("form").submit(function() { $(":submit",this).attr("disabled", "disabled"); }); .csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .... [More]

Session keep alive in jQuery style

When you want to keep the session alive when a user is visiting a page without refreshes, there is a technique to make this happen. This is for example useful when you have a survey page with a long list of questions that will take a while to answer completely. The technique is simple (best solutions mostly are simple). You need to notify the server that the client PC is still browsing the page. All you need is a client side script that sends a Ping message behind the scenes and a server side page that handles that ping request. First the server side: since the request doesn’t need a G... [More]

Add IntelliSense for custom jQuery libraries

When you have worked with Visual Studio, you know the power of IntelliSense which helps you speed up coding. It works well with VB/C# languages, but it can also be useful for writing JavaScript / jQuery. When writing JavaScript only basic suggestions are shown: As you can see, only ajax.js, dhtml.js and ecma.js are mentioned. I have my own lib scene.dataservice.js in the VS project, but that doesn’t show up here. There is a simple trick to make this work. Just add <reference path=”<your_favourite_script>.js” /> as a comment, and see the magic: Hope this hel... [More]