title: When added HTML Form tag JavaScript executes, but magically disappeared
body: <p>I had a successful execution before adding the form tag. But somehow the JavaScript is replaced. Is there a way to do without this form submission. I need to pass the data to PHP. Thank You in Advance..</p>
  
  <p>This is the <strong>html</strong> I tried</p>
  
  <pre><code>&lt;!DOCTYPE html&gt; 
  &lt;html&gt; 
  
  &lt;head&gt; 
      &lt;script src="riu003.js"&gt;&lt;/script&gt; 
  &lt;/head&gt; 
  
  &lt;body&gt; 
      &lt;form name="myform" method="post" action="/riu/riu-01/riu001.php" enctype="multipart/form-data"&gt; 
          &lt;div id="aaa"&gt; 
          &lt;/div&gt; 
          &lt;button style="width: 100%" class="bbb" onclick="addfielderbutt()"&gt;Add Fields&lt;/button&gt; 
          &lt;button style="width: 100%; height: 45px; background-color: dodgerblue" onclick="submity()" type="Submit" value="submit"&gt;SUBMIT&lt;/button&gt; 
      &lt;/form&gt; 
  &lt;/body&gt; 
  
  &lt;/html&gt;
  </code></pre>
  
  <p>And here is the <strong>JavaScript</strong> file.</p>
  
  <pre><code>function createElemented(element, attribute, inner) {
      if (typeof(element) === "undefined") { return false; }
      if (typeof(inner) === "undefined") { inner = ""; }
      var el = document.createElement(element);
      if (typeof(attribute) === 'object') {
          for (var key in attribute) {
              el.setAttribute(key, attribute[key]);
          }
      }
      if (!Array.isArray(inner)) { inner = [inner]; }
      for (var k = 0; k &lt; inner.length; k++) {
          if (inner[k].tagName) {
              el.appendChild(inner[k]);
          } else {
              el.appendChild(document.createTextNode(inner[k]));
          }
      }
      return el;
  };
  var noofclicks = 0;
  
  function addfielderbutt() {
      noofclicks = noofclicks + 1;
      var uptexty = createElemented("TEXTAREA", { class: "upt_" + noofclicks, name: "positiveuse_" + noofclicks, type: "text" }, "Type the postive uses here...");
      var nptexty = createElemented("TEXTAREA", { class: "unt_" + noofclicks, name: "negativeuse_" + noofclicks, type: "text" }, "Type the negative uses here...");
      var dptexty = createElemented("TEXTAREA", { class: "dpt_" + noofclicks, name: "positivedisuse_" + noofclicks, type: "text" }, "Type the postive disuses here...");
      var dntexty = createElemented("TEXTAREA", { class: "dnt_" + noofclicks, name: "negativedisuse_" + noofclicks, type: "text" }, "Type the negative disuses here...");
      var breakkk = createElemented("BR");
      document.getElementById("aaa").appendChild(uptexty);
      document.getElementById("aaa").appendChild(nptexty);
      document.getElementById("aaa").appendChild(dptexty);
      document.getElementById("aaa").appendChild(dntexty);
      document.getElementById("aaa").appendChild(breakkk);
  }
  
  function submity(){  
      document.cookie = "numberofclicks="+noofclicks; 
  }
  </code></pre>