title: Set the Selected Attribute on the Selected Option in jQuery
body: <p>I have the following implementation which triggers the change event whenever I change the select values. </p>
  
  <pre><code> $(element).on("change", function() {
  
  
  
              });
  </code></pre>
  
  <p>Now, inside the on change function I need to get the option that is selected and then attach the selected = selected attribute to it. </p>
  
  <p>So I can get the value using the following: </p>
  
  <pre><code>  $(element).on("change", function() {
  
                  alert($(this).find(":selected").text());
  
              });
  </code></pre>
  
  <p>But the selected value is not reflected in the user interface. It still shows no selection.</p>