How do I select and unselect multiple elements with JavaScript or jQuery?
<p>I am working currently on some online editor and I would like to have there the posibility to select multiple elements (all this same class) while holding ctrl key - just like in most of the programs and then make some actions on them - eg. align.</p>

<p>The second thing what I want to achive is to be able to deselect all when I click somewhere - if on element then all beside this, if outside all elements then all elements.</p>

<p>I was trying to insert them into a table if they are clicked and then perform some action - only on objects from this table, but then I don't know how to make them be select only with ctrl button if there is any.</p>

<p>I have also tried this function on clicking outside objects:</p>

<pre><code>$('html').click(function(){
    alert("Deselect");
})
</code></pre>

<p>But it does't work either.</p>

<p>So, does anyone know any other way to perform this actions?</p>

<p>And here is an example of what I would like to achive (you have to click <code>Advanced Editing</code>) - I mean the align list in the right top corner of editor. Also there is deselection of object when you press outside one, and ctrl selection.</p>

<p><a href="http://www.vistaprint.com/vp/ns/studio3.aspx?pf_id=064&amp;combo_id=120585&amp;free_studio_gallery=true&amp;referer=http://www.vistaprint.com/vp/ns/default.aspx?dr=1&amp;rd=2&amp;GPS=2357948912&amp;GNF=1&amp;GPLSID=&amp;rd=2#doc_id=2170662331" rel="nofollow">http://www.vistaprint.com</a></p>

<p>Thank you for your help and ideas.</p>
