Jump to content
Fórum Script Brasil
  • 0

Duvida Campo Dinamicamente com Function


Gneccao

Question

Boa Noite,

Tenho um Formulario, no qual ao apertar um botao, ele carrega + 1 campo dinamicamente, so que tenho uma function que completa 1 campo apartir do valor desses campos que são adicionados dinamicanete, o problema que não sei como passar o id dos campos, pois o mesmo tem como name="pecas[]" id="pecas[]", por causa do [ ] que utilizo para adicionar, não consigo passar o nome.

alguém poderia me ajudar?

Segue os Scripts

<script>
                    Jquery(function()
                    {
                            var linh2 = Jquery('tbody#add_km tr').size();       
                            if(linh2 == 0)
                            {
                                document.getElementById('adicionar_km').style.display = \"\";
                                alert(linh2);
                            }
                            else
                            {
                             var linha = Jquery('tbody#add_km tr').html();
                             Jquery('tbody#add_km').append('<tr>' + linha + '</tr>');
                            }  
                    });
 </script>

<tbody id="add_km">
  <tr id="adicionar_km" style="display: none;">
  <td width="25%">
  De: <input type="text" name="De[]" /> 
  </td>
  <td width="25%">
  Para: <input type="text" name="Para[]" />
  </td>
  <td width="25%">
  Km: <input type="text" name="km[]" onblur="somar_km(this,'??????')" />
  </td>
  <td width="25%">
  Valor: <input type="text" name="valor_km[]" readonly="readonly" id="valor_km[]"> 
  </td>
  </tr>
  </tbody>

Grato

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Forum Statistics

    • Total Topics
      152.2k
    • Total Posts
      652k
×
×
  • Create New...