JQuery
Prevent Enter Key Submitting Forms With JQuery
Fri, 07/15/2011 - 09:35 | by philipnorton42A common practice that some users have is to press the enter key when they are filling in forms on the web. This might be when they are just moving to the next field, but the trouble is that this will submit the form.
To prevent this from happening you can simply stop the form being submitted if the enter key had been pressed. This is done by binding a JQuery event to the input elements of the form and returning false if the key pressed is enter, which has the keyCode value of 13. We also include a call to the JQuery method preventDefault() to stop the event propagating.
Using jQuery To Load Content Onto A Page Without An iFrame
Tue, 02/08/2011 - 23:20 | by philipnorton42iFrames can be a convinent way of loading content from one domain onto another, but they do have their limitations. For example, it usually isn't possible to style the contents of the iFrame and you are therefore left at the mercy of a third party site. They also look pretty shonky if the third party site does down for whatever reason. Displaying large "page not found" statements on your page is quite unsightly.
Enabling The Use Of delay() In Pre jQuery 1.4
Mon, 01/24/2011 - 13:58 | by philipnorton42The other day I was trying to convert a HTML template into a CMS system and I found a stumbling block with the use of the jQuery function delay() in the template's JavaScript. During part of the templating process I found the following error occurring on the page.
Using JQuery To Open External Links In A New Window
Fri, 02/19/2010 - 10:17 | by philipnorton42Opening external links in a new window can be useful, but adding target="_blank" can be a real chore. Not only that, but if you are trying to validate the page to XHTML strict then the target attribute will cause errors to appear as it is not defined in XHTML.
Scroll To First Error Message On Page With jQuery And ScrollTo
Fri, 01/29/2010 - 10:25 | by philipnorton42If you have a large page or form that uses validation on it then you will probably want to tell the user that something is going on. One way to do this is by telling the user at the top of the page that something has gone wrong and then letting them figure out where.
A more elegant solution is to scroll the page down the just above the first error message so that the user is aware of what they need to fill in. This can easily be done through a combination of jQuery and the ScrollTo plugin.
JQuery Image Switcher
Mon, 12/07/2009 - 21:40 | by philipnorton42Using something like CrossSlide is fine if you want fancy effects in your image translations, but for more simple effects you can use a single function to simply swap one image for another. First, lets create some simple markup that will allow us to display some images.
<div class="slideshow"> <img src="image1.png" alt="Image 1" /> <img src="image2.png" alt="Image 2" /> <img src="image3.png" alt="Image 3" /> <img src="image4.png" alt="Image 4" /> </div>