I\'m making a formbuilder, I would like to change the appearance of for example a heading div. When clicked it should get a border but when another dynamically generated div
In this mode you can find all element which has class active and remove it
try this
$(document).ready(function() { $(this.attr('id')).click(function () { $(document).find('.active').removeClass('active'); var DivId = $(this).attr('id'); alert(DivId); $(this).addClass('active'); }); });