Check if element exists in jQuery

Simple way to check if element exists in jQuery.

The $('#module2') is always truthy, because an empty array is truthy Boolean([]). So the length needs to be checked:

if ($('#module2').length > 0) {
  // Exists
} else {
  // Does not exist
}