Javascript and IE7

26 November 2009 tags:

Just a quick post. Something to look for with Internet Explorer 7 and Javascript (not JQuery specifically). The following will work fine in IE8, FF and even IE6, but not IE7:

$("#foo").validate({
    rules: {
      firstname: 'required',
      lastname: 'required',
      phone: 'required',
      email: {required:true,email:true},
      street: 'required',
      city: 'required',
      state: 'required',
      postcode: 'required',
      service_areas: 'required',
    }
  });

Whereas this will:

$("#foo").validate({
    rules: {
      firstname: 'required',
      lastname: 'required',
      phone: 'required',
      email: {required:true,email:true},
      street: 'required',
      city: 'required',
      state: 'required',
      postcode: 'required',
      service_areas: 'required'
    }
  });

Spot the difference? That single comma after the last rule hash. That will stop IE7 from processing Javascript and result in your other events not getting fired.


Possibly Similar Pages


Comments on this post

blog comments powered by Disqus
loading