How to get element by classname or id

后端 未结 4 612
栀梦
栀梦 2020-11-27 12:35

I am trying to find the element in html by angularjs.

Here is the html:

4条回答
  •  孤独总比滥情好
    2020-11-27 13:16

    You don't have to add a . in getElementsByClassName, i.e.

    var multibutton = angular.element(element.getElementsByClassName("multi-files"));
    

    However, when using angular.element, you do have to use jquery style selectors:

    angular.element('.multi-files');
    

    should do the trick.

    Also, from this documentation "If jQuery is available, angular.element is an alias for the jQuery function. If jQuery is not available, angular.element delegates to Angular's built-in subset of jQuery, called "jQuery lite" or "jqLite.""

提交回复
热议问题