I have a link function in an directive where i have a toggle functionality to edit the currently active DOM element's css content . How do i access the parent or child class of that DOM element .
A part of the directive :
link: function(scope, element, attrs) {
var title = angular.element(element.children()[0]),
opened = true;
title.bind('click', toggle);
function toggle() {
opened = !opened;
element.removeClass(opened ? 'closed' : 'opened');
element.addClass(opened ? 'opened' : 'closed');
element.siblings().removeclass('opened').addclass('closed'); // What to do here
}