title: How do you set attribute selected for element and remove attributes from rest?
body: <p>The thing that i'm trying to accomplish is when the option is selected by user, it should add dom attribute "selected" to that element. And remove "selected" attribute from other listed elements.</p>
  
  <pre><code>&lt;select id="tSelect" class="form-control input-sm"&gt;
      &lt;option value="Inlook"&gt;Inlook&lt;/option&gt;
      &lt;option value="Metallium"&gt;Metallium&lt;/option&gt;
      &lt;option value="Ossmet"&gt;Ossmet&lt;/option&gt;
  &lt;/select&gt;
  </code></pre>
  
  <pre class="lang-js prettyprint-override"><code>$("#tSelect").change(function(){
      $("#tSelect option:selected").removeAttr('selected');
      var val = $(this).val();
      $('#tSelect option[value="' + val + '"]').attr("selected", "selected");
  });
  </code></pre>
  
  <p>This is my code so far, but it seems not to be working.</p>