javascript object iterate through element for attribute
<p>Below, I am trying to iterate through each attribute in an input element.  It isn't working and I'm not sure why.  Is this an incorrect use of the object named input?  How do I change this?</p>

<pre><code>&lt;script&gt;
   $('form.trade').submit(function(e) {
      e.preventDefault();
      input=$(this).find(':input:first');
      value='';

      $.each(input.attributes, function(i, attrib){
        if (attrib.name!='type'){
            value +=attrib.name + ":" + attrib.value + ";";
        }
      });
      });
&lt;/script&gt;
&lt;form class="trade" id="24243"&gt;
&lt;input type="hidden" available="4" pid="24243" cardname="something" yay="blah"&gt;
Available: &lt;p class="available"&gt;4&lt;/p&gt;
&lt;input type="submit" value="add card"&gt;
&lt;/form&gt;
&lt;br/&gt;
&lt;form class="trade" id="24245"&gt;
&lt;input type="hidden" available="7" pid="24243" cardname="somethik" yay="blakk"&gt;
Available: &lt;p class="available"&gt;7&lt;/p&gt;
&lt;input type="submit" value="add card"&gt;
&lt;/form&gt;
</code></pre>
