title: Modifying html attributes with jQuery producing unexpected results
body: <p>I am experiencing some unusual results with my jQuery and was hoping that somebody could enlighten me as to why.  I am sure that jQuery is powerful enough to do this, so I wonder what I am doing wrong.  Here is what I have (some seemingly simple and easy to understand code):</p>
  
  <pre><code>///////////reset default search entries/////////////
  $("#sOrderByDLM").attr('checked', 'checked');
  $("#sOrderByID").attr('checked', '');
  $("#sOrderByPOIName").attr('checked', '');
  $("#sOrderByAge").attr('checked', '');
  $("#sOrderByOfficer").attr('checked', '');
  
  $("#sOrderByDesc").attr('checked', 'checked');
  $("#sOrderByAsc").attr('checked', '');
  </code></pre>
  
  <p>I have this inside a simple javaScript function that is called on the click of a non-submit type (normal) button.  The problem is that when I click this, instead of it filling the <code>sOrderByDLM</code> radio button, it actually fills the <code>sOrderByOfficer</code> button and likewise with the bottom two jQuery statements (e.g., <code>sOrderByAsc</code> becomes '<code>checked</code>' instead of <code>sOrderByDesc</code>) Am I not blatantly telling jQuery to reset the '<code>checked</code>' attribute to that of the second argument, which is blank, except in the cases where I specifically set it to '<code>checked</code>' for the fields I intend to be default? </p>
  
  <p>I experienced a similar problem with checkboxes, but I found a work around by simply calling the same statements in reverse order, but that doesn't seem to work here, though.  If I set '<code>checked="checked"</code>' in razor everything is fine, but I need this button to work on the client side.</p>
  
  <p>Anyway, if the HTML is necessary, I will provide it, but I doubt it is needed since the I have triple checked the ids to be sure.</p>
  
  <p>Thanks for any help!</p>
  
  <p>(And God Bless Stack Overflow, I don't know what I would do without you! :D)</p>
  
  <p>UPDATE:</p>
  
  <pre><code>                    &lt;tr&gt;
                          &lt;td class="orderlineupColor"&gt;&lt;label for="sOrderByDLM"&gt;Date Last Modified&lt;/label&gt;&lt;br/&gt;&lt;input type="radio" id="sOrderByDLM" name="sOrderBy" style="margin-left: 115px;" value="OrderByDLM" @OrderByFiller[0] /&gt;&lt;/td&gt;
                          &lt;td class="orderlineupColor"&gt;&lt;label for="sOrderByID"&gt;Entry ID&lt;/label&gt;&lt;br/&gt;&lt;input type="radio" id="sOrderByID" name="sOrderBy" style="margin-left: 115px;" value="OrderByID" @OrderByFiller[1] /&gt;&lt;/td&gt;
                          &lt;td class="orderlineupColor"&gt;&lt;label for="sOrderByPOIName"&gt;POI Name&lt;/label&gt;&lt;br/&gt;&lt;input type="radio" id="sOrderByPOIName" name="sOrderBy" style="margin-left: 115px;" value="OrderByPOIName" @OrderByFiller[2] /&gt;&lt;/td&gt;
                          &lt;td class="orderlineupColor"&gt;&lt;label for="sOrderByAge"&gt;Age&lt;/label&gt;&lt;br/&gt;&lt;input type="radio" id="sOrderByAge" name="sOrderBy" style="margin-left: 115px;" value="OrderByAge" @OrderByFiller[3] /&gt;&lt;/td&gt;
                          &lt;td class="orderlineupColor"&gt;&lt;label for="sOrderByOfficer"&gt;Officer&lt;/label&gt;&lt;br/&gt;&lt;input type="radio" id="sOrderByOfficer" name="sOrderBy" style="margin-left: 115px;" value="OrderByOfficer" @OrderByFiller[4] /&gt;&lt;/td&gt;
                      &lt;/tr&gt;
                      &lt;tr&gt;
                          &lt;td class="orderlineupColor2"&gt;In Descending Or&lt;br/&gt;Ascending Order:&lt;/td&gt;
                          &lt;td class="orderlineupColor2"&gt;&lt;label for="sOrderByDesc"&gt;Descending Order&lt;/label&gt;&lt;br/&gt;&lt;input type="radio" id="sOrderByDesc" name="sAscOrDesc" style="margin-left: 115px;" value="OrderByDesc" @OrderByAscOrDescFiller[0] /&gt;&lt;/td&gt;
                          &lt;td class="orderlineupColor2"&gt;&lt;label for="sOrderByAsc"&gt;Ascending Order&lt;/label&gt;&lt;br/&gt;&lt;input type="radio" id="sOrderByAsc" name="sAscOrDesc" style="margin-left: 115px;" value="OrderByAsc" @OrderByAscOrDescFiller[1] /&gt;&lt;/td&gt;
                          &lt;td class="orderlineupColor2"&gt;&lt;button type="button" class="smallbtn" onclick="clearSortEntries()"&gt;Reset Sort Entries&lt;/button&gt;&lt;/td&gt;
                          &lt;td class="orderlineupColor2"&gt;&lt;/td&gt;
                      &lt;/tr&gt;
  </code></pre>