0

I used this code to find my elements in the angular controller:

var el = angular.element('#id');

But this doesn't work. why?

Is it true that I use jQuery to find my elements ?

I confused my code doesn't work any more.

  • Possible duplicate of [How to get element by classname or id](http://stackoverflow.com/questions/23609171/how-to-get-element-by-classname-or-id) – Sa E Chowdary Apr 14 '17 at 09:43

1 Answers1

0

Please try:

angular.element(document.getElementById("id"));
  • It works but why `angular.element('#id')` worked before? –  Apr 14 '17 at 09:53
  • I don't know, always I use this. –  Apr 14 '17 at 10:05
  • 2
    i think i figured out your problem. you used to earlier versions of **angularjs 1.x** before and now you're working with newer one.this function was changed after some versions – Majid Parvin Apr 14 '17 at 10:11
  • Thank you @Majid Parvin. your comment help me more than this answer.I have updated recently. –  Apr 14 '17 at 10:21