title: JavaScript runtime error: Cannot assign to a function result
body: <p>HI I am extremely new to Javascript and I am having a problem with updating a text box within gridview.</p>
  
  <p>here is my current attempt</p>
  
  <pre><code> function startCalc() {
          var grid = document.getElementById("GridView1");
          for (var i = 0; i &lt; grid.rows.length - 1; i++) {
              var rate = $("Span[id*=Rate]");
              var qty = $("input[id*=TextAmount]");
              var ra = parseFloat(rate[i].textContent);                        
              $("input[id*=TextVat]") = qty[i].value * parseFloat(rate[i].textContent);
  
          }
           }
  </code></pre>
  
  <p>However I keep getting an error saying that Cannot assign to a function result.</p>
  
  <p>any help would be appreciated</p>
  
  <p>below is the piece of code from my gridview where essentially I want to multiply the TextBox ID="TextAmount" by Label ID="Rate" and put the result into TextBox ID="TextVat"</p>
  
  <pre><code>            &lt;asp:GridView ID="GridView1" runat="server" AllowSorting="True" DataSourceID="SqlDataSource1" Height="138px" AutoGenerateColumns="False" HorizontalAlign="Center" BackColor="White" BorderColor="#CCCCCC" BorderStyle="Groove" BorderWidth="1px" CellPadding="4" ForeColor="Black" GridLines="Horizontal"&gt;
                  &lt;Columns&gt;
                      &lt;asp:BoundField DataField="ID" HeaderText="ID" InsertVisible="False" ReadOnly="True" SortExpression="ID" /&gt;
                      &lt;asp:BoundField DataField="item" HeaderText="item" SortExpression="item" /&gt;
                      &lt;asp:TemplateField HeaderText="Vat" SortExpression="Vat"&gt;
                          &lt;EditItemTemplate&gt;
                              &lt;asp:TextBox ID="TextBox1" runat="server" Text='&lt;%# Bind("Vat") %&gt;'&gt;&lt;/asp:TextBox&gt;
                          &lt;/EditItemTemplate&gt;
                          &lt;ItemTemplate&gt;
                              &lt;asp:Label ID="Rate" runat="server" Text='&lt;%# Bind("Vat") %&gt;'&gt;&lt;/asp:Label&gt;
                          &lt;/ItemTemplate&gt;
                      &lt;/asp:TemplateField&gt;
                      &lt;asp:TemplateField HeaderText="Quantity"&gt;
                          &lt;ItemTemplate&gt;&lt;asp:TextBox ID="TextQuantity" runat="server"  class="calculate" onchange="calculate()" Text="0" &gt;&lt;/asp:TextBox&gt;&lt;/ItemTemplate&gt;
                      &lt;/asp:TemplateField&gt;
                      &lt;asp:TemplateField HeaderText="Amount"&gt;
                          &lt;ItemTemplate&gt;&lt;asp:TextBox ID="TextAmount" runat="server"  class="calc" onchange="calc()" Text="0" &gt;&lt;/asp:TextBox&gt;&lt;/ItemTemplate&gt;
                      &lt;/asp:TemplateField&gt;
                      &lt;asp:TemplateField HeaderText="Vat Amount"&gt;
                          &lt;ItemTemplate&gt;&lt;asp:TextBox ID="TextVat" runat="server"   &gt;&lt;/asp:TextBox&gt;&lt;/ItemTemplate&gt;
                      &lt;/asp:TemplateField&gt;
                  &lt;/Columns&gt;
                  &lt;FooterStyle BackColor="#CCCC99" ForeColor="Black" /&gt;
                  &lt;HeaderStyle ForeColor="White" BackColor="#333333" Font-Bold="True" /&gt;
                  &lt;PagerStyle BackColor="White" ForeColor="Black" HorizontalAlign="Right" /&gt;
                  &lt;SelectedRowStyle BackColor="#CC3333" Font-Bold="True" ForeColor="White" /&gt;
                  &lt;SortedAscendingCellStyle BackColor="#F7F7F7" /&gt;
                  &lt;SortedAscendingHeaderStyle BackColor="#4B4B4B" /&gt;
                  &lt;SortedDescendingCellStyle BackColor="#E5E5E5" /&gt;
                  &lt;SortedDescendingHeaderStyle BackColor="#242121" /&gt;
              &lt;/asp:GridView&gt;
  </code></pre>
  
  <p>Thanks</p>