title: How to use addClass() to prepend the class in the element's class list
body: <p>I hav a div in my HTML</p>
  
  <pre><code>    &lt;button id="abc" class="btn btn-primary btn-block"&gt;&lt;/button&gt;
  </code></pre>
  
  <p>I need to add a class 'alert-danger' on mouseover. So i used the following code</p>
  
  <pre><code>    $(document).on("mouseover","#abc",function()
      {
            $(this).addClass("alert-danger");
      });
  </code></pre>
  
  <p>This works fine and it appends the class at the end of the class list as below</p>
  
  <pre><code>    &lt;button id="abc" class="btn btn-primary btn-block alert-danger"&gt;&lt;/button&gt;
  </code></pre>
  
  <p>But the problem is 'btn' and 'alert-danger' classes have some common css rules. 'btn' takes priority (as it is first in the list) and disables the rules of 'alert-danger'.So my button should be like this with 'alert-danger' class as the first in the classlist.</p>
  
  <pre><code>    &lt;button id="abc" class="alert-danger btn btn-primary btn-block"&gt;&lt;/button&gt; // My requirement 
  </code></pre>
  
  <p>How to modify my addClass() in order to prepend the class instead of appending it.</p>