title: password check directive elem.add error
body: <p>I'm making a password checking directive to ensure password and confirm_password fields are the same:</p>
  
  <pre><code>angular
      .module('myModule')
      .directive('pwCheck', function() {
          return {
              require: 'ngModel',
              link: function (scope, elem, attrs, ctrl) {
                  var password = "#" + attrs.pwCheck;
                  elem.add(password).on('keyup', function() {
                      scope.$apply(function () {
                          ctrl.$setValidity('pwmatch', elem.val() === $(password).val());
                      });
                  });
              }
          };
  });
  </code></pre>
  
  <p>I get a error when adding the <code>keyup</code> handler to both pw and pw check fields:</p>
  
  <blockquote>
    <p>TypeError: elem.add is not a function</p>
  </blockquote>
  
  <p>So I removed <code>.add()</code> and just do </p>
  
  <p><code>elem.on('keyup', function() {</code></p>
  
  <p>Now I'm getting the following error:</p>
  
  <blockquote>
    <p>ReferenceError: $ is not defined</p>
  </blockquote>
  
  <p>I'm following <a href="http://codepen.io/brunoscopelliti/pen/CctvH?editors=101" rel="nofollow">this</a> codepen. I've set the angular app correctly, and the directive logs the html elements (elem, attrs, ctrl) fine. So I'm not sure what the problem is.</p>