title: TypeError: undefined is not a function when serializing a form
body: <p>I am new to js and am trying to serialize the values in a form to get it ready for submission into ajax.</p>
  
  <p>In my browser, I get this error and I am not sure why:</p>
  
  <pre><code>$('#myform').serializeObject()
  Uncaught TypeError: undefined is not a function
  </code></pre>
  
  <p>Here is the code I am running:</p>
  
  <pre><code>$.fn.serializeObject = function () {
      var o = {};
      var a = this.serializeArray();
      $.each(a, function () {
          if (o[this.name] !== undefined) {
              if (!o[this.name].push) {
                  o[this.name] = [o[this.name]];
              }
              o[this.name].push(this.value || '');
          } else {
              o[this.name] = this.value || '';
          }
      });
      return o;
  };
  
  $(document).ready(function () {
      console.log("Hello there! How are you?");
      mydata = JSON.stringify($('#myform').serializeObject());
      console.log(mydata);
  });
  </code></pre>
  
  <p>Here is a <a href="http://jsfiddle.net/qqoupsyb/" rel="nofollow">jsfiddle</a> I created to make it easier. I thought the problem could be in <code>serializeObject</code>, but the debugger does not even get to that point.</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>Though I corrected this typo (which came up while I was creating the post), I get the same error. I tried this is firefox, and I got <code>TypeError: $(...).serializeObject is not a function</code>. Strangely, it works fine on jsfiddle.</p>