title: Debugging the return value of a jQuery selector
body: <p>I am looking for a way to debug what a jquery selector returns. I have tried using <code>toString()</code>, but that only ever returns <code>[object Object]</code>.</p>
  
  <p>What I am actually trying to do is to attach a callback to radio buttons. And <code>onclick</code>
  on one of the buttons, I want to submit the enclosing form.</p>
  
  <p>Therefore I try to do something like this:</p>
  
  <pre><code>$(".rating").stars({
      cancelShow: false,
      callback: function(ui, type, value, event) {
          $(this).closest('form').ajaxSubmit();
      }
  });
  </code></pre>
  
  <p>Unfortunately, nothing happens.</p>
  
  <p>Here is a complete example of what I am trying to do:</p>
  
  <pre><code>&lt;script type="text/javascript" src="http://localhost:8000/media/js/jquery.js?v=1.4.2"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="http://localhost:8000/media/js/jquery.form.js?v=2.4.3"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="http://localhost:8000/media/js/jquery-ui.custom.min.js?v=1.8"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" language="javascript" src="http://localhost:8000/media/js/jquery.ui.stars.js?v=3.0.0b38"&gt;&lt;/script&gt;
  &lt;link rel="stylesheet" type="text/css" media="all" href="http://localhost:8000/media/css/jquery.ui.stars.css?v=3.0.0b38" /&gt;        
  
  &lt;body&gt;
   &lt;script type="text/javascript"&gt;
      $(function() {
          $(".rating").children().not(":radio").hide();
          $(".rating").stars({
              cancelShow: false,
              callback: function(ui, type, value, event) {
                  alert('NodeName: ' + this.nodeName);
                  $(this).each(function() {
                      alert($(this).html());
                  });
  
                  alert($(this).length);
              }
          });
      });
   &lt;/script&gt;
  
   &lt;ul class="list"&gt;
    &lt;li&gt;
     &lt;form class="rating" id="rating-1" action="/sniphunter/rate/1/" method="post"&gt;
      &lt;input type="radio" name="score" value="1" id="rating-1-1" /&gt;
      &lt;input type="radio" name="score" value="2" id="rating-1-2" /&gt;
      &lt;input type="radio" name="score" value="3" id="rating-1-3" /&gt;
      &lt;input type="radio" name="score" value="4" id="rating-1-4" /&gt;
      &lt;input type="radio" name="score" value="5" id="rating-1-5" /&gt;
      &lt;input type="submit" value="Rate"/&gt;
     &lt;/form&gt;
    &lt;/li&gt;
   &lt;/ul&gt;
  &lt;/body&gt;
  </code></pre>