I
I
Isherath2018-06-04 20:30:44
Angular
Isherath, 2018-06-04 20:30:44

Working with AngularJS DOM?

There is a directive:

app.directive('selectionRating', function() {
    return {
        link: function($scope, element, attrs) {
            
            var tar = element.children();
            
            tar.bind('click', function() {
                
                this.addClass('second');
                
            });
            
            
        }
    }
});

There is an element in which there are several elements . By clicking on any of the elements, I need to change its class. How can i do this?
Everything I've tried doesn't work. These are addClass(), removeClass(). Even ordinary inserts into an element of type html().

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question