title: adding textInput values to another text input using js function in Yii 2
body: <p>Simply I'm trying to add value of text Input fields to another as : <a href="http://jsfiddle.net/MaK2k/1/" rel="nofollow">http://jsfiddle.net/MaK2k/1/</a></p>
  
  <p>my form code :</p>
  
  <pre><code>    &lt;?php
          $script = &lt;&lt;&lt; JS
              $('#amount_value_id').keyup(function(){
                  var amountSum=0;
                  $('#amount_value_id').each(function(){
                      if (this.value != "")
                          amountSum+=parseInt(this.value);
                  });
                  // alert('foo');
                  $("#totalamount").text(amountSum);
                  //console.log(amountSum);
  
              });
          JS;
          $this-&gt;registerJs($script);
      ?&gt;
  &lt;?php $form = ActiveForm::begin(["id" =&gt; "project-form"]); ?&gt;
  
    &lt;?php foreach ($project as $i =&gt; $project) { ?&gt;
  
       &lt;div class="col-lg-2 col-md-3" id="amount_value_id"&gt;
                                      &lt;?= $form-&gt;field($project, "[{$i}]amount")-&gt;textInput(); ?&gt;
                                  &lt;/div&gt;
  
                                    &lt;?php } ?&gt;
  
                                      &lt;div class="col-lg-2" id="totalamount"&gt;
              &lt;?php echo $form-&gt;field($model, 'total_amount')-&gt;textInput(['maxlength' =&gt; 128, 'id' =&gt; 'totalamount']) ?&gt;
          &lt;/div&gt;
  </code></pre>
  
  <p>In the text Input for total amount that should holds the total sum is giving NaN !! .What I'm doing ??</p>