title: Using elements for multiple funcitons
body: <p>As a beginner for javascript, I'm having some difficulties to build functions so that multiple functions use the same element on a page. The purpose of the function is to calculate and display a value based on the input of a user.</p>
  <p>The function looks like this:</p>
  <pre><code>&lt;script language='javascript' type='text/javascript'&gt;
  document.getElementById(&quot;n182849949&quot;).onblur = function () {
    reSumText1();
  };
  document.getElementById(&quot;n182849950&quot;).onblur = function () {
    reSumText1();
  };
  document.getElementById(&quot;n182849951&quot;).onblur = function () {
    reSumText1();
  };
  document.getElementById(&quot;n182849952&quot;).onblur = function () {
    reSumText1();
  };
  
  function Tonumber(numX) {
    return Number(numX.replace(&quot;.&quot;, &quot;&quot;).replace(&quot; &quot;, &quot;&quot;).replace(&quot;,&quot;, &quot;.&quot;));
  }
  
  function reSumText1() {
    var num1 = Tonumber(document.getElementById(&quot;n182849949&quot;).value);
    var num2 = Tonumber(document.getElementById(&quot;n182849950&quot;).value);
    var num3 = Tonumber(document.getElementById(&quot;n182849951&quot;).value);
    var num4 = Tonumber(document.getElementById(&quot;n182849952&quot;).value);
    var sum2 = num1 + num2 + num3 + num4;
    var sum3 = sum2.toLocaleString(&quot;de-DE&quot;);
    document.getElementById(&quot;1&quot;).innerHTML = sum3;
  }
  &lt;/script&gt;
  </code></pre>
  <p>The function works as intended, but as soon as there is another function using one of the elements, only one is working:</p>
  <pre><code>&lt;script language='javascript' type='text/javascript'&gt;
  document.getElementById(&quot;n182853134&quot;).onblur = function () {
    reSumText2();
  };
  document.getElementById(&quot;n182853151&quot;).onblur = function () {
    reSumText2();
  };
  document.getElementById(&quot;n182853118&quot;).onblur = function () {
    reSumText2();
  };
  document.getElementById(&quot;n182849952&quot;).onblur = function () {
    reSumText2();
  };
  
  function Tonumber(numX) {
    return Number(numX.replace(&quot;.&quot;, &quot;&quot;).replace(&quot; &quot;, &quot;&quot;).replace(&quot;,&quot;, &quot;.&quot;));
  }
  
  function reSumText2() {
    var num1 = Tonumber(document.getElementById(&quot;n182853134&quot;).value);
    var num2 = Tonumber(document.getElementById(&quot;n182853151&quot;).value);
    var num3 = Tonumber(document.getElementById(&quot;n182853118&quot;).value);
    var num4 = Tonumber(document.getElementById(&quot;n182849952&quot;).value);
    var sum2 = num1 + num2 + num3 + num4;
    var sum3 = sum2.toLocaleString(&quot;de-DE&quot;);
    document.getElementById(&quot;2&quot;).innerHTML = sum3;
  }
  &lt;/script&gt;
  </code></pre>
  <p>Both of the functions &quot;reSumText1&quot; and &quot;reSumText2&quot; work separately, but not together on the same page, since they both use the element n182849952. Is there a way to work around?</p>
  <p>Thanks a lot in advance!</p>