Check so at least one checkbox on your form is checked before it’s allowed to submit:


   if ( $("input[type='checkbox']:checked").length > 0) {

   else {

         alert("Please check at least one list you wish to be included in.");
         return false;

   return true;



Here’s how you can get the image width and height of an image file at a remote URL.

function getImgDims(url){
   var img = new Image();
   img.onload = function(){
      var rtnArr=Array;
      return rtnArr;

This will return an a multi-element associative array containing values under “width” and “height” as its keys.

In case you ever need to manually validate those pesky multi-field credit card date fields, you know “Month” and “Year” and you want to make sure the expiration is never set prior to the current month for obvious reasons like the credit card would get declined, you need to have the browser client side figure out (or be given the value through PHP injection into your JS script) the last date of the last day of the current month so you can then calculate and compare the “Month” and “Year” fields to this date value.

Using Javascript’s Date object should be adequate for most browsers and IE 8 or greater (there’s a work around to accommodate older browsers, but is it really worth reaching people who are using IE7?!  That’s a cost/benefit decision you and your marketing team will have to make.)

dt=new Date();
new Date(dt.getFullYear(), dt.getMonth() + 1, 0, 23, 59, 59)

No Javascript libraries like JQuery is required!

Here’s an exercise to create a new date object and convert today’s parts into the more human-readable month/day/year format. It’s not built into the Javascript language, what can you do?! Here’s a breakdown of some of the main methods built into the Date class, just the main ones

var today = new Date();
var dd = today.getDate();
var mm = today.getMonth()+1; //January starts at ZERO, don't ask why
var yyyy = today.getFullYear();

if(dd<10) {   dd='0'+dd} 
if(mm<10) {   mm='0'+mm} 

today = mm+'/'+dd+'/'+yyyy;

ShareThis is a useful tool to encourage sharing of your website’s pages and content with others in social media. It has other uses as well since it can link users to account they’re already logged into making it easier to re-tweet or post your page on Facebook. However, at the top of the URL the ShareThis Javascript calls on the ShareThis API and appends to the user’s browser’s address bar one very ugly hashtag:

sharethis-ugly-hashtagAccording to the ShareThis team, just change the “hashAddressBar:” parameter in the ShareThis Javascript from “true” to “false” so it looks like this:  hashAddressBar:false.  More info can be found at: — notice the “#sthash!” by the way…