Send data along with form

0

Complementing my previous question (goo.gl/rNMK7c) and I want to click on the button to fill out the form and the code will pick up which product the customer is interested in, since it will have a button for each item, when the customer clicks on the button that in the image this as contact is informed in the form which item he was interested, where are the arrows, how to do without php, not studied yet, know little, follow print of the site that I am doing prntscr.com/ghgf8p

    
asked by anonymous 05.09.2017 / 19:31

1 answer

0

$('button').on('click', function(){
  $('#id').val($(this).attr('data-id'))
})
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><form><inputtype="text" id="id" placeholder="ID">
   <input type="text" placeholder="nome">
</form>

<button data-id="1">Primeiro item</button>
<button data-id="2">Segundo item</button>

You can not understand your question very much, but I think it's something like that.

    
05.09.2017 / 19:53