title: onchange text on javascript woocommerce
body: <pre class="lang-PHP-HTML-JS prettyprint-override"><code>&lt;?php
  echo'
    &lt;form&gt;
      &lt;input type=&quot;text&quot; id=&quot;falk_id&quot; name=&quot;falk&quot;   value=&quot;&quot; maxlength=&quot;4&quot;/&gt;
      &lt;input type=&quot;text&quot; id=&quot;dis_id&quot;  name=&quot;coupon&quot; value=&quot;&quot; maxlength=&quot;4&quot;/&gt;
    &lt;/form&gt;
    &lt;script&gt;
      var falakTayebElement = document.getElementById(&quot;falk_id&quot;);
      var discountElement   = document.getElementById(&quot;dis_id&quot;);
      var totalPoints       = &lt;?php echo $points;?&gt;;
  
      falakTayebElement.onchange = function() {
        var points                  = parseInt(falakTayebElement.value);
        var discount                = points / 3 ;
        discountElement.value       = &quot;saasa&quot;;
        //discountElement.innerHTML = discount.toFixed(2);
      };
  
      discountElement.onchange = function() {
        var discount = parseFloat(discountElement.value);
        var points   = discount * 3;
        if(points &gt; totalPoints) {
          falakTayebElement.style.color = &quot;red&quot;; // to show error text
          falakTayebElement.value       = &quot;ليس لديك رصيد كافي من النقاط !&quot;
        } else {
          falakTayebElement.value       = points.toFixed(2);
        }
      }
    &lt;/script&gt;';
    }
  ?&gt;
  </code></pre>
  <p>I don't know what's wrong here, but by changing the element I didn't get any result on the other textfeild.
  #javascript #php #woocommerce
  any advice, notes..?</p>