Assigning clicked element's ID as classname to another element
<p>I am working on a project but the code that I wrote is really wrong:</p>

<pre><code>$('#lart').click(function(){
  $("#form3").addClass("lart");
});
$('#posht').click(function(){
  $("#form3").addClass("posht");
});
$('#majt').click(function(){
  $("#form3").addClass("majt");
});
$('#djatht').click(function(){
  $("#form3").addClass("djatht");
});
</code></pre>

<p>I think about making it with switch statement but I dont know how to make the variable for the cases. The above code doesnt work properly because when I click more options then it adds more classes and I don't want it to add more classes, just one of them (lart,posht,djatht,majt).</p>

<p>what if I want it to have two pairs like just to change the lart with posht and majt with djatht, by the way this is the meaning of the ids: lart=up posht=down majt=left djatht=right so if I click the up button then I click right the class up with stay its just going to add 1 more class called right, or left! or if I click the down button then I will can change the right or left but it will be (down and left/right or up and left/right) is this possible?</p>
