try using !== instead of != as this checks also against the variable type.
you can also try if ( typeof myvar ==='undefined'){ //error } On Thu, Jan 8, 2009 at 10:25 PM, Chuk <violinssoundc...@gmail.com> wrote: > > Hi. I have a form with a disabled submit button when the page is > loaded. I'm trying to activate that submit button only when two text > fields(ids="equipmentNumber" and "description") and three select boxes > (ids="type","department"," and "location") contain a value. Here is > my current code: > > if ($('#equipmentNumber').val() != null && $('#description').val() != > null && $('#type').val() != null && $('#department') != null && $ > ('#location').val() != null) > { > $('#submit').attr("disabled",false); > } > > However, this condition is always true...even if each field is blank. > Does anyone see right off where I've messed up?