Javascript set value of one field in others

3

I have the following code below

<script type="text/javascript">
    function getValue() {
      var x = document.getElementById("NuJaneiro");

      document.getElementById("NuFevereiro").value = x.value;
    }
  </script>

 <td>
    <input type="text" style="width: 80px;" runat="server" id="NuJaneiro" value='<%# DecimalPontoVigula(Eval("Janeiro"))%>'
      name="NuJaneiro" onblur="getValue()" />
  </td>


  <td>
    <input type="text" style="width: 80px;" runat="server" id="NuFevereiro" value='<%# DecimalPontoVigula(Eval("Fevereiro"))%>'
      name="NuFevereiro" onblur="getValue()" />
  </td>

My idea is to get the value of one field and by another as soon as the user exits the first field, however, the value is not being passed and when I debug the browser it locks the screen.

    
asked by anonymous 17.12.2015 / 18:35

1 answer

3

In Web Forms, the ID by default is generated dynamically.

Change the ClientIDMode property to Static so this does not occur and remain the ID you set.

<asp:TextBox runat="server" ID="NuJaneiro" ClientIDMode="Static" />
    
17.12.2015 / 18:55