Never compare with == or! = when true / false is involved. Always use === and! ==.
In addition, according to jQuery api , val () is guaranteed to return null only if there are no matches for this selector; and returns "" (empty string) if one field matches, but empty.
source
share