Category: jQuery

L

Learn jQuery: A simple ‘Hello World’ jQuery Code

jQuery - A powerful javascript library capable of doing all your complex javascript actions and functionality in a line or two. How cool is that. Pre-requisites : Notepad, jquery.js file(You can get it here),  some coding background and an open mind Let's Start with a simple Hello World: Open your notepad, create a html file ...

j

jQuery : To check if an element is present in the page or not

This is a precautionary measure that you can adopt, if you are doubtful about the presence of a particular control in the page. Under normal scenarios, in case if the element is not there, it would throw an error. But you can now check if that particular element is present in the page or not, ...

j

jQuery Intellisense for VS 2008

Found this weblog from ScottGuru very useful. You can now add intellisense to the jquery code that you write in your web Application. http://weblogs.asp.net/scottgu/archive/2008/11/21/jquery-intellisense-in-vs-2008.aspx Enjoy jQuery to its full!

J

Javascript to check any redirection to another page

When the user had made some changes in the page and accidentally clicks some links on the page, you might want to warn the user about the redirection and ask his permission for the operation. Javascript makes it quite simple to do this operation, with the help of window.onbeforeunload(): window.onbeforeunload = checkRedirection; function checkRedirection (evt) ...

J

Javascript to maximise window on load

Well this is simple script to get your browser maximised onload: <html> <head> <script language="JavaScript"> window.onload = maxWindow; function maxWindow() { window.moveTo(0,0); if (document.all) { top.window.resizeTo(screen.availWidth,screen.availHeight); } else if (document.layers||document.getElementById) { if (top.window.outerHeight<screen.availHeight||top.window.outerWidth<screen.availWidth) { top.window.outerHeight = screen.availHeight; top.window.outerWidth = screen.availWidth; } } } </script> </head> <body>Testing</body> </html> I just tested it it IE. Hope this ...

H

How to suppress nagging javascript errors?

To suppress javascript error popups and warnings in your browser, just use the code snippet below: <SCRIPT language="JavaScript"> <!-- function silentErrorHandler() {return true;} window.onerror=silentErrorHandler; //--> </SCRIPT> This however has some limitation, from what i had experienced. It works well in IE, to a major extend in Firefox, but not much in Opera and Safari. Hence ...

j

jQuery not working from external js file?

I had faced this issue in one of my development projects. I used jquery lavishly in every bit of my javascript code. Since during development, i used to write the scripts in the page itself, i didn't have to bother much. But later when i decided to move the scripts to another external ".js" file, ...

j

jQuery: Add (all), Remove (All) – operations between two Listboxes

Consider the scenario below: In case of operations between two list boxes like add, add all, remove, remove all; jQuery is quite amazing with it. With the use of appendTo method, you just need one line for each of the four operations. Checkout the code below: $(document).ready(function(){ $("#btnAdd").click(function() { $("select[id$='lstAllAgents'] > option:selected").appendTo("select[id$='lstGroupMembers']"); }); $("li#btnAddAll").click(function() { ...

M

Mutually Exclusive with Select All checkbox

The full code: (Copy the code below into a new folder with the jquery-1.3.2.min.js file in it and run the page). Getting a select all checkbox to work can prove to be simple in jQuery. But a select all isn't just on click of a checkbox on top of the column. It has to do ...