title: How do I get rid of this JS error: TypeError: $(...).validate is not a function
body: <p>I am using the following JS code from the fiddle provided in the answer here: </p>
  
  <p><a href="https://stackoverflow.com/questions/14741688/how-to-display-messages-from-jquery-validate-plugin-inside-of-tooltipster-toolti">How to display messages from jQuery Validate plugin inside of Tooltipster tooltips?</a></p>
  
  <p>Here's the fiddle: <a href="http://jsfiddle.net/kyK4G/" rel="nofollow noreferrer">http://jsfiddle.net/kyK4G/</a></p>
  
  <p>The error shows up on line 36, which is: submitHandler: function (form) { // for demo</p>
  
  <p>And this is the error: </p>
  
  <pre><code>TypeError: $(...).validate is not a function
  
  submitHandler: function (form) { // for demo
  </code></pre>
  
  <p>Code:</p>
  
  <pre><code>&lt;script src="http://code.jquery.com/jquery-1.10.1.min.js"&gt;&lt;/script&gt;
  
  $(document).ready(function () {
  
      // initialize tooltipster on text input elements
      $('#myform input[type="text"]').tooltipster({
          trigger: 'custom',
          onlyOne: false,
          position: 'right'
      });
  
      // initialize validate plugin on the form
      $('#myform').validate({
          errorPlacement: function (error, element) {
              $(element).tooltipster('update', $(error).text());
              $(element).tooltipster('show');
          },
          success: function (label, element) {
              $(element).tooltipster('hide');
          },
          rules: {
              field1: {
                  required: true,
                  email: true
              },
              field2: {
                  required: true,
                  minlength: 5
              }
          },
          submitHandler: function (form) { // for demo
              alert('valid form');
              return false;
          }
      });
  
  });
  
  // no CDN - including plugin below
  (function (d, f, g, b) {
      var e = "tooltipster",
          c = {
              animation: "fade",
              arrow: true,
              arrowColor: "",
              content: "",
              delay: 200,
              fixedWidth: 0,
              maxWidth: 0,
              functionBefore: function (l, m) {
                  m()
              },
              functionReady: function (l, m) {},
              functionAfter: function (l) {},
              icon: "(?)",
              iconDesktop: false,
              iconTouch: false,
              iconTheme: ".tooltipster-icon",
              interactive: false,
              interactiveTolerance: 350,
              offsetX: 0,
              offsetY: 0,
              onlyOne: true,
              position: "top",
              speed: 350,
              timer: 0,
              theme: ".tooltipster-default",
              touchDevices: true,
              trigger: "hover"
          };
  
      function h(m, l) {
          this.element = m;
          this.options = d.extend({}, c, l);
          this._defaults = c;
          this._name = e;
          this.init()
      }
      function j() {
          return !!("ontouchstart" in f)
      }
      function a() {
          var l = g.body || g.documentElement;
          var n = l.style;
          var o = "transition";
          if (typeof n[o] == "string") {
              return true
          }
          v = ["Moz", "Webkit", "Khtml", "O", "ms"], o = o.charAt(0).toUpperCase() + o.substr(1);
          for (var m = 0; m &lt; v.length; m++) {
              if (typeof n[v[m] + o] == "string") {
                  return true
              }
          }
          return false
      }
      var k = true;
      if (!a()) {
          k = false
      }
      h.prototype = {
          init: function () {
              var r = d(this.element);
              var n = this;
              var q = true;
              if ((n.options.touchDevices == false) &amp;&amp; (j())) {
                  q = false
              }
              if (g.all &amp;&amp; !g.querySelector) {
                  q = false
              }
              if (q == true) {
                  if ((this.options.iconDesktop == true) &amp;&amp; (!j()) || ((this.options.iconTouch == true) &amp;&amp; (j()))) {
                      var m = r.attr("title");
                      r.removeAttr("title");
                      var p = n.options.iconTheme;
                      var o = d('&lt;span class="' + p.replace(".", "") + '" title="' + m + '"&gt;' + this.options.icon + "&lt;/span&gt;");
                      o.insertAfter(r);
                      r.data("tooltipsterIcon", o);
                      r = o
                  }
                  var l = d.trim(n.options.content).length &gt; 0 ? n.options.content : r.attr("title");
                  r.data("tooltipsterContent", l);
                  r.removeAttr("title");
                  if ((this.options.touchDevices == true) &amp;&amp; (j())) {
                      r.bind("touchstart", function (t, s) {
                          n.showTooltip()
                      })
                  } else {
                      if (this.options.trigger == "hover") {
                          r.on("mouseenter.tooltipster", function () {
                              n.showTooltip()
                          });
                          if (this.options.interactive == true) {
                              r.on("mouseleave.tooltipster", function () {
                                  var t = r.data("tooltipster");
                                  var u = false;
                                  if ((t !== b) &amp;&amp; (t !== "")) {
                                      t.mouseenter(function () {
                                          u = true
                                      });
                                      t.mouseleave(function () {
                                          u = false
                                      });
                                      var s = setTimeout(function () {
                                          if (u == true) {
                                              t.mouseleave(function () {
                                                  n.hideTooltip()
                                              })
                                          } else {
                                              n.hideTooltip()
                                          }
                                      }, n.options.interactiveTolerance)
                                  } else {
                                      n.hideTooltip()
                                  }
                              })
                          } else {
                              r.on("mouseleave.tooltipster", function () {
                                  n.hideTooltip()
                              })
                          }
                      }
                      if (this.options.trigger == "click") {
                          r.on("click.tooltipster", function () {
                              if ((r.data("tooltipster") == "") || (r.data("tooltipster") == b)) {
                                  n.showTooltip()
                              } else {
                                  n.hideTooltip()
                              }
                          })
                      }
                  }
              }
          },
          showTooltip: function (m) {
              var n = d(this.element);
              var l = this;
              if (n.data("tooltipsterIcon") !== b) {
                  n = n.data("tooltipsterIcon")
              }
              if ((d(".tooltipster-base").not(".tooltipster-dying").length &gt; 0) &amp;&amp; (l.options.onlyOne == true)) {
                  d(".tooltipster-base").not(".tooltipster-dying").not(n.data("tooltipster")).each(function () {
                      d(this).addClass("tooltipster-kill");
                      var o = d(this).data("origin");
                      o.data("plugin_tooltipster").hideTooltip()
                  })
              }
              n.clearQueue().delay(l.options.delay).queue(function () {
                  l.options.functionBefore(n, function () {
                      if ((n.data("tooltipster") !== b) &amp;&amp; (n.data("tooltipster") !== "")) {
                          var w = n.data("tooltipster");
                          if (!w.hasClass("tooltipster-kill")) {
                              var s = "tooltipster-" + l.options.animation;
                              w.removeClass("tooltipster-dying");
                              if (k == true) {
                                  w.clearQueue().addClass(s + "-show")
                              }
                              if (l.options.timer &gt; 0) {
                                  var q = w.data("tooltipsterTimer");
                                  clearTimeout(q);
                                  q = setTimeout(function () {
                                      w.data("tooltipsterTimer", b);
                                      l.hideTooltip()
                                  }, l.options.timer);
                                  w.data("tooltipsterTimer", q)
                              }
                              if ((l.options.touchDevices == true) &amp;&amp; (j())) {
                                  d("body").bind("touchstart", function (B) {
                                      if (l.options.interactive == true) {
                                          var D = d(B.target);
                                          var C = true;
                                          D.parents().each(function () {
                                              if (d(this).hasClass("tooltipster-base")) {
                                                  C = false
                                              }
                                          });
                                          if (C == true) {
                                              l.hideTooltip();
                                              d("body").unbind("touchstart")
                                          }
                                      } else {
                                          l.hideTooltip();
                                          d("body").unbind("touchstart")
                                      }
                                  })
                              }
                          }
                      } else {
                          d("body").css("overflow-x", "hidden");
                          var x = n.data("tooltipsterContent");
                          var u = l.options.theme;
                          var y = u.replace(".", "");
                          var s = "tooltipster-" + l.options.animation;
                          var r = "-webkit-transition-duration: " + l.options.speed + "ms; -webkit-animation-duration: " + l.options.speed + "ms; -moz-transition-duration: " + l.options.speed + "ms; -moz-animation-duration: " + l.options.speed + "ms; -o-transition-duration: " + l.options.speed + "ms; -o-animation-duration: " + l.options.speed + "ms; -ms-transition-duration: " + l.options.speed + "ms; -ms-animation-duration: " + l.options.speed + "ms; transition-duration: " + l.options.speed + "ms; animation-duration: " + l.options.speed + "ms;";
                          var o = l.options.fixedWidth &gt; 0 ? "width:" + l.options.fixedWidth + "px;" : "";
                          var z = l.options.maxWidth &gt; 0 ? "max-width:" + l.options.maxWidth + "px;" : "";
                          var t = l.options.interactive == true ? "pointer-events: auto;" : "";
                          var w = d('&lt;div class="tooltipster-base ' + y + " " + s + '" style="' + o + " " + z + " " + t + " " + r + '"&gt;&lt;div class="tooltipster-content"&gt;' + x + "&lt;/div&gt;&lt;/div&gt;");
                          w.appendTo("body");
                          n.data("tooltipster", w);
                          w.data("origin", n);
                          l.positionTooltip();
                          l.options.functionReady(n, w);
                          if (k == true) {
                              w.addClass(s + "-show")
                          } else {
                              w.css("display", "none").removeClass(s).fadeIn(l.options.speed)
                          }
                          var A = x;
                          var p = setInterval(function () {
                              var B = n.data("tooltipsterContent");
                              if (d("body").find(n).length == 0) {
                                  w.addClass("tooltipster-dying");
                                  l.hideTooltip()
                              } else {
                                  if ((A !== B) &amp;&amp; (B !== "")) {
                                      A = B;
                                      w.find(".tooltipster-content").html(B);
                                      w.css({
                                          width: "",
                                          "-webkit-transition-duration": l.options.speed + "ms",
                                          "-moz-transition-duration": l.options.speed + "ms",
                                          "-o-transition-duration": l.options.speed + "ms",
                                          "-ms-transition-duration": l.options.speed + "ms",
                                          "transition-duration": l.options.speed + "ms",
                                          "-webkit-transition-property": "-webkit-transform",
                                          "-moz-transition-property": "-moz-transform",
                                          "-o-transition-property": "-o-transform",
                                          "-ms-transition-property": "-ms-transform",
                                          "transition-property": "transform"
                                      }).addClass("tooltipster-content-changing");
                                      setTimeout(function () {
                                          w.removeClass("tooltipster-content-changing");
                                          setTimeout(function () {
                                              w.css({
                                                  "-webkit-transition-property": "",
                                                  "-moz-transition-property": "",
                                                  "-o-transition-property": "",
                                                  "-ms-transition-property": "",
                                                  "transition-property": ""
                                              })
                                          }, l.options.speed)
                                      }, l.options.speed);
                                      tooltipWidth = w.outerWidth(false);
                                      tooltipInnerWidth = w.innerWidth();
                                      tooltipHeight = w.outerHeight(false);
                                      l.positionTooltip()
                                  }
                              }
                              if ((d("body").find(w).length == 0) || (d("body").find(n).length == 0)) {
                                  clearInterval(p)
                              }
                          }, 200);
                          if (l.options.timer &gt; 0) {
                              var q = setTimeout(function () {
                                  w.data("tooltipsterTimer", b);
                                  l.hideTooltip()
                              }, l.options.timer + l.options.speed);
                              w.data("tooltipsterTimer", q)
                          }
                          if ((l.options.touchDevices == true) &amp;&amp; (j())) {
                              d("body").bind("touchstart", function (B) {
                                  if (l.options.interactive == true) {
                                      var D = d(B.target);
                                      var C = true;
                                      D.parents().each(function () {
                                          if (d(this).hasClass("tooltipster-base")) {
                                              C = false
                                          }
                                      });
                                      if (C == true) {
                                          l.hideTooltip();
                                          d("body").unbind("touchstart")
                                      }
                                  } else {
                                      l.hideTooltip();
                                      d("body").unbind("touchstart")
                                  }
                              })
                          }
                          w.mouseleave(function () {
                              l.hideTooltip()
                          })
                      }
                  });
                  n.dequeue()
              })
          },
          hideTooltip: function (m) {
              var p = d(this.element);
              var l = this;
              if (p.data("tooltipsterIcon") !== b) {
                  p = p.data("tooltipsterIcon")
              }
              var o = p.data("tooltipster");
              if (o == b) {
                  o = d(".tooltipster-dying")
              }
              p.clearQueue();
              if ((o !== b) &amp;&amp; (o !== "")) {
                  var q = o.data("tooltipsterTimer");
                  if (q !== b) {
                      clearTimeout(q)
                  }
                  var n = "tooltipster-" + l.options.animation;
                  if (k == true) {
                      o.clearQueue().removeClass(n + "-show").addClass("tooltipster-dying").delay(l.options.speed).queue(function () {
                          o.remove();
                          p.data("tooltipster", "");
                          d("body").css("verflow-x", "");
                          l.options.functionAfter(p)
                      })
                  } else {
                      o.clearQueue().addClass("tooltipster-dying").fadeOut(l.options.speed, function () {
                          o.remove();
                          p.data("tooltipster", "");
                          d("body").css("verflow-x", "");
                          l.options.functionAfter(p)
                      })
                  }
              }
          },
          positionTooltip: function (O) {
              var A = d(this.element);
              var ab = this;
              if (A.data("tooltipsterIcon") !== b) {
                  A = A.data("tooltipsterIcon")
              }
              if ((A.data("tooltipster") !== b) &amp;&amp; (A.data("tooltipster") !== "")) {
                  var ah = A.data("tooltipster");
                  ah.css("width", "");
                  var ai = d(f).width();
                  var B = A.outerWidth(false);
                  var ag = A.outerHeight(false);
                  var al = ah.outerWidth(false);
                  var m = ah.innerWidth() + 1;
                  var M = ah.outerHeight(false);
                  var aa = A.offset();
                  var Z = aa.top;
                  var u = aa.left;
                  var y = b;
                  if (A.is("area")) {
                      var T = A.attr("shape");
                      var af = A.parent().attr("name");
                      var P = d('img[usemap="#' + af + '"]');
                      var n = P.offset().left;
                      var L = P.offset().top;
                      var W = A.attr("coords") !== b ? A.attr("coords").split(",") : b;
                      if (T == "circle") {
                          var N = parseInt(W[0]);
                          var r = parseInt(W[1]);
                          var D = parseInt(W[2]);
                          ag = D * 2;
                          B = D * 2;
                          Z = L + r - D;
                          u = n + N - D
                      } else {
                          if (T == "rect") {
                              var N = parseInt(W[0]);
                              var r = parseInt(W[1]);
                              var q = parseInt(W[2]);
                              var J = parseInt(W[3]);
                              ag = J - r;
                              B = q - N;
                              Z = L + r;
                              u = n + N
                          } else {
                              if (T == "poly") {
                                  var x = [];
                                  var ae = [];
                                  var H = 0,
                                      G = 0,
                                      ad = 0,
                                      ac = 0;
                                  var aj = "even";
                                  for (i = 0; i &lt; W.length; i++) {
                                      var F = parseInt(W[i]);
                                      if (aj == "even") {
                                          if (F &gt; ad) {
                                              ad = F;
                                              if (i == 0) {
                                                  H = ad
                                              }
                                          }
                                          if (F &lt; H) {
                                              H = F
                                          }
                                          aj = "odd"
                                      } else {
                                          if (F &gt; ac) {
                                              ac = F;
                                              if (i == 1) {
                                                  G = ac
                                              }
                                          }
                                          if (F &lt; G) {
                                              G = F
                                          }
                                          aj = "even"
                                      }
                                  }
                                  ag = ac - G;
                                  B = ad - H;
                                  Z = L + G;
                                  u = n + H
                              } else {
                                  ag = P.outerHeight(false);
                                  B = P.outerWidth(false);
                                  Z = L;
                                  u = n
                              }
                          }
                      }
                  }
                  if (ab.options.fixedWidth == 0) {
                      ah.css({
                          width: m + "px",
                          "padding-left": "0px",
                          "padding-right": "0px"
                      })
                  }
                  var s = 0,
                      V = 0;
                  var X = parseInt(ab.options.offsetY);
                  var Y = parseInt(ab.options.offsetX);
                  var p = "";
  
                  function w() {
                      var an = d(f).scrollLeft();
                      if ((s - an) &lt; 0) {
                          var am = s - an;
                          s = an;
                          ah.data("arrow-reposition", am)
                      }
                      if (((s + al) - an) &gt; ai) {
                          var am = s - ((ai + an) - al);
                          s = (ai + an) - al;
                          ah.data("arrow-reposition", am)
                      }
                  }
                  function t(an, am) {
                      if (((Z - d(f).scrollTop() - M - X - 12) &lt; 0) &amp;&amp; (am.indexOf("top") &gt; -1)) {
                          ab.options.position = an;
                          y = am
                      }
                      if (((Z + ag + M + 12 + X) &gt; (d(f).scrollTop() + d(f).height())) &amp;&amp; (am.indexOf("bottom") &gt; -1)) {
                          ab.options.position = an;
                          y = am;
                          V = (Z - M) - X - 12
                      }
                  }
                  if (ab.options.position == "top") {
                      var Q = (u + al) - (u + B);
                      s = (u + Y) - (Q / 2);
                      V = (Z - M) - X - 12;
                      w();
                      t("bottom", "top")
                  }
                  if (ab.options.position == "top-left") {
                      s = u + Y;
                      V = (Z - M) - X - 12;
                      w();
                      t("bottom-left", "top-left")
                  }
                  if (ab.options.position == "top-right") {
                      s = (u + B + Y) - al;
                      V = (Z - M) - X - 12;
                      w();
                      t("bottom-right", "top-right")
                  }
                  if (ab.options.position == "bottom") {
                      var Q = (u + al) - (u + B);
                      s = u - (Q / 2) + Y;
                      V = (Z + ag) + X + 12;
                      w();
                      t("top", "bottom")
                  }
                  if (ab.options.position == "bottom-left") {
                      s = u + Y;
                      V = (Z + ag) + X + 12;
                      w();
                      t("top-left", "bottom-left")
                  }
                  if (ab.options.position == "bottom-right") {
                      s = (u + B + Y) - al;
                      V = (Z + ag) + X + 12;
                      w();
                      t("top-right", "bottom-right")
                  }
                  if (ab.options.position == "left") {
                      s = u - Y - al - 12;
                      myLeftMirror = u + Y + B + 12;
                      var K = (Z + M) - (Z + A.outerHeight(false));
                      V = Z - (K / 2) - X;
                      if ((s &lt; 0) &amp;&amp; ((myLeftMirror + al) &gt; ai)) {
                          var o = parseFloat(ah.css("border-width")) * 2;
                          var l = (al + s) - o;
                          ah.css("width", l + "px");
                          M = ah.outerHeight(false);
                          s = u - Y - l - 12 - o;
                          K = (Z + M) - (Z + A.outerHeight(false));
                          V = Z - (K / 2) - X
                      } else {
                          if (s &lt; 0) {
                              s = u + Y + B + 12;
                              ah.data("arrow-reposition", "left")
                          }
                      }
                  }
                  if (ab.options.position == "right") {
                      s = u + Y + B + 12;
                      myLeftMirror = u - Y - al - 12;
                      var K = (Z + M) - (Z + A.outerHeight(false));
                      V = Z - (K / 2) - X;
                      if (((s + al) &gt; ai) &amp;&amp; (myLeftMirror &lt; 0)) {
                          var o = parseFloat(ah.css("border-width")) * 2;
                          var l = (ai - s) - o;
                          ah.css("width", l + "px");
                          M = ah.outerHeight(false);
                          K = (Z + M) - (Z + A.outerHeight(false));
                          V = Z - (K / 2) - X
                      } else {
                          if ((s + al) &gt; ai) {
                              s = u - Y - al - 12;
                              ah.data("arrow-reposition", "right")
                          }
                      }
                  }
                  if (ab.options.arrow == true) {
                      var I = "tooltipster-arrow-" + ab.options.position;
                      if (ab.options.arrowColor.length &lt; 1) {
                          var R = ah.css("background-color")
                      } else {
                          var R = ab.options.arrowColor
                      }
  </code></pre>