Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I am trying to add a CSS class of open a DIV's sibling.

Here's my HTML:

<div id="profile-information">
    // Code
</div>
<div class="profile-info">
    <div class="profile-content">
        // Code
    </div>
</div>

So, with the sructure above, i am trying to add CSS class open to the DIV with class class="profile-content" via:

var sectionID = "profile-information";

angular.element(document).find('#' + sectionID).next('.profile-info').find('.profile-content').addClass('open');

For some reason the above is not working.

share|improve this question
    
can you provide a JSFiddle ? –  c69 yesterday
    
Is there a particular reason why do you manipulate DOM instead of using MVC pattern and actually drive your View with Controller? –  maurycy yesterday
1  
You are doing it wrong, default jQuery-like DOM manipulation in AngularJS is a very bad idea. Google ng-class and read how to use angularjs properly, right now you just breaking this framework. –  Nikolay Talanov yesterday
    
@NikolayTalanov - completely forgot about ng-class!!! Thanks. –  Oam Psy yesterday

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.