title: jquery change all value attr for input fields
body: <p>This doesn't apply to form fields.</p>
  
  <p>Let's say I have this in html:</p>
  
  <pre><code>&lt;input id="something" value="myvalue"&gt;
  &lt;input id="somethingelse" value="myvalue"&gt;
  </code></pre>
  
  <p>And I have javascript that does this:</p>
  
  <pre><code>something.value="ME";
  somethingelse.value="TOO";
  </code></pre>
  
  <p>And I want to manipulate the DOM so that when we inspect the element "something" it reflects this:</p>
  
  <pre><code>&lt;input id="something" value="ME"&gt;
  </code></pre>
  
  <p>If I do this in jquery explicitly it works:</p>
  
  <pre><code>$("#something").attr("value",something.value.toString());
  </code></pre>
  
  <p>But I need something more generic - I need to change EVERY input item so that it behaves like this.</p>
  
  <p>So I tried:</p>
  
  <pre><code>$("input").each(function () {
      $(this).attr("value", this.value.toString());
  })
  </code></pre>
  
  <p>But it doesn't change at all.  It leaves it alone.</p>
  
  <p>So I tried this:</p>
  
  <pre><code>$("input").each(function () {
  $(this).attr("value", "NeverA");
  })
  </code></pre>
  
  <p>And it doesn't change it either.</p>
  
  <p>But I tried</p>
  
  <pre><code>$("input").each(function () {
      alert(this.value.toString());
  })
  </code></pre>
  
  <p>And it is alerting each value - so the selector is good.</p>
  
  <p>What am I doing wrong?</p>