title: How check for ID existence using jQuery?
body: <p>I want to have a line of code similar to below:</p>
  
  <pre><code>var name = $('#input-name').attr("value");
  </code></pre>
  
  <p>However, the id 'input-name' is not guaranteed to exist.  How do I check for its existence so that the assignment does not throw an error?</p>