Example code so I can start explaining this problem:
5
2
I just figured out that there's a 'start dragging' event in .draggable. How silly of me.
$("#window-"+id+".staticwindow.stwin").draggable({ ... start: function(e, u){ $(".window").removeClass('active'); $(this).addClass('active'); } });
Although this approach of mine is not related to my original question anymore, atleast there's no looping. I'm not going to accept any answer because this seems to need a loop. (Although I'm slightly inclined to accept the answer by zarko-o because it lead me to think on events)
Thanks everyone for your answers!