title: Removing dynamic form element with jquery validation rules
body: <p>I have created a HTML form where users can dynamically add and remove input fields.</p>
  
  <h3>Update (again)</h3>
  
  <p>After <strike>wasting</strike> investing :) a few more hours on this problem I can replicate this issue/bug/error in a very simple example. I'm not sure how to debug any more than this. You will need the latest version of jquery validate and unobtrusive validation.</p>
  
  <p>Here's the code:</p>
  
  <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
  &lt;head&gt;
      &lt;title&gt;&lt;/title&gt;
      &lt;script src="Content/scripts/jquery-1.5.1.js" type="text/javascript"&gt;&lt;/script&gt;
      &lt;script src="Content/scripts/jquery.validate.js" type="text/javascript"&gt;&lt;/script&gt;
      &lt;script src="Content/scripts/jquery.validate.unobtrusive.js" type="text/javascript"&gt;&lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;form action="" method="post"&gt;
          Click me to remove: &lt;input type="checkbox" id="chkTest" /&gt;
      &lt;/form&gt;
      &lt;script type="text/javascript"&gt;
          $(function () {
              $("input#chkTest").click(function () {
                  $(this).remove();
              });
          });
      &lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Click the checkbox and you will get the error:</p>
  
  <blockquote>
    <p>Error: Unable to get value of the property 'nodeName': object is null or undefined</p>
  </blockquote>