How do I add/remove a class in a <div> when it already has classes
<p>How do I add/remove a class from a div when it already has one or more classes?</p>

<pre><code>&lt;div class="class1 class2" id="id1"&gt;some text&lt;/div&gt;



$("#id1").toggleClass("class3"); // doesn't work


$("#id1").toggleClass(" class3"); // doesn't work
</code></pre>

<p>Do I have to parse the string?</p>
