0

Setup:

<div>
  <div class="application-section active"></div>
  <div class="application-section"></div>      
</div>

I am setting a the following variables

var $activeSection = $("div.application-section.active"); 
var $targetSection = $activeSection.prev("div.application-section");

jQuery Documentation states that if no previous sibiling is found, it will return a blank jquery object. I want to do additional stuff if the variable is a blank jQuery object, but how do you check to see if it is a blank jQuery object? I have tried the following, but I always get false as a result.

alert($.isEmptyObject($targetSection));
Neve12ende12
  • 1,154
  • 4
  • 17
  • 33
  • To be fair, the duplicate question would have been hard to find because it is written confusingly. A jQuery selector can't "return null". – aebabis May 23 '14 at 21:01

1 Answers1

4

$targetSection.length will be zero if no matching selector is found.

Diodeus - James MacFarlane
  • 112,730
  • 33
  • 157
  • 176