title: How to use jQuery hasClass when the selector is a JS variable
body: <p>I am trying to use jQuery's <code>hasClass</code> function. It doesn't seem to work when I use it like this. I would appreciate it if anyone can work out how to use hasClass in this situation.</p>
  
  <p>The error I am getting is </p>
  
  <pre><code>numValueElement.hasClass is not a function
  if($(numValueElement.hasClass("tag"))) 
  </code></pre>
  
  <p>The key line throwing this error is this one <code>if($(numValueElement.hasClass("tag")))</code> </p>
  
  <pre><code>$(".numberValue").click
      (
          function ()
          {
              var numValueElement = this;
              var propertyId = numValueElement.id;
              $(".numberBounds").filter("#"+propertyId).toggle();
              if($(numValueElement.hasClass("tag")))
              {
              }
  
          }
      );
  </code></pre>