Is a non_active
class non_active
? I would omit this, and then using jQuery I would do the following (advanced for reading):
$('a').on('click', function(e){ e.preventDefault(); // prevent the default <a> behaviour var $elm = $(this), // store the clicked element activateElement = $elm.attr('href'); // get the value of the href attribute $('.active').removeClass('active'); // remove currently active element $(activateElement).addClass('active'); // set clicked element to active by removing non_active });
CSS
div{ visibility: hidden; } .active{ visibility:visible; }
Demo
source share