AngularJS Error "element.children(...).slideToggle is not a function"

As the title says, whenever I click on an element that is supposed to have a description of what the element is, I get that error. I have tried removing the E in restrict: 'E' and replacing it with 'A' and that didn't work. I have tried to get my function to work many ways as I can and I can't seem to get it to work. it is supposed to show the text in an element when you click on it. Could you please help me with this?

module.exports = function() {
    return {
        restrict: 'EA',
        templateUrl: 'api.html',
        link: function(scope, element) {
            //Dom manipulation
            element.on("click", function(e) {

Answers 1

  • element.children(':last-child').slideToggle();

    Is empty or undefined, so there is no function slideToggle for it.





Related Articles