title: Checking if selectors are blank in jQuery
body: <p>I am currently using a .js file with jQuery commands to find certain elements of a .xml file. I have been able to gather all the data I want easily, however am having a bit of difficulty with the presentation.</p>
  
  <p>I am using the same .js script for the loading of multiple .xml files. The data is gathered in an html document and in list form. Here is the code:</p>
  
  <pre><code>        $upgrade1 = $(xml).find("upgrades").eq(0).next();
          $upgrade2 = $(xml).find("upgrades").eq(1).next();
          $upgrade3 = $(xml).find("upgrades").eq(2).next();
          $("#upgrades").append($upgrade1.text() + "&lt;li&gt;" + $upgrade2.text() + "&lt;/li&gt;&lt;li&gt;" + $upgrade3.text() + "&lt;/li&gt;");
  </code></pre>
  
  <p>Now as you can see first the selectors compile the text they need and then it is added to the <code>&lt;li class ="upgrades"&gt;</code>. Now the issue here is that some .xml files will only have 1 or 2 upgrades rather than all 3. Yet the function will still draw out blank bullet points due to the <code>&lt;li&gt;</code> elements in the .append()</p>
  
  <p>The easiest solution is the use an if statement, however I can't seem to find anywhere how you would check if the selector is blank? There are only mentions of checking form elements, but this is not helpful to me. Possibly a way to check for an empty string or a string of less than 1 character? I don't know...</p>
  
  <p>Does anyone have any ideas?</p>